diff --git a/App.vue b/App.vue index 5b5b9866..9ee06f8d 100644 --- a/App.vue +++ b/App.vue @@ -1,41 +1,46 @@ + @import '@/sheep/scss/index.scss'; + \ No newline at end of file diff --git a/pages/coupon/list.vue b/pages/coupon/list.vue index 4d6a156e..4bb02a0e 100644 --- a/pages/coupon/list.vue +++ b/pages/coupon/list.vue @@ -1,242 +1,261 @@ + .card-btn { + // width: 144rpx; + padding: 0 16rpx; + height: 50rpx; + border-radius: 40rpx; + background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); + color: #ffffff; + font-size: 24rpx; + font-weight: 400; + } + + .border-btn { + background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light)); + color: #fff !important; + } + + .disabled-btn { + background: #cccccc; + background-color: #cccccc !important; + color: #fff !important; + } + \ No newline at end of file diff --git a/pages/goods/comment/add.vue b/pages/goods/comment/add.vue index 0392516e..a0902194 100644 --- a/pages/goods/comment/add.vue +++ b/pages/goods/comment/add.vue @@ -1,157 +1,209 @@ + .star-box { + height: 100rpx; + padding: 0 25rpx; + } + + .star-title { + font-weight: 600; + } + } + + .area-box { + width: 690rpx; + min-height: 306rpx; + background: rgba(249, 250, 251, 1); + border-radius: 20rpx; + padding: 28rpx; + margin: auto; + + .img-box { + margin-top: 20rpx; + } + } + + .post-btn { + width: 690rpx; + line-height: 80rpx; + border-radius: 40rpx; + color: rgba(#fff, 0.9); + margin-bottom: 20rpx; + } + \ No newline at end of file diff --git a/pages/goods/index.vue b/pages/goods/index.vue index 2c70b59c..1661dfcb 100644 --- a/pages/goods/index.vue +++ b/pages/goods/index.vue @@ -1,417 +1,400 @@ + border-radius: 0 40rpx 40rpx 0; + background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); + color: $white; + } + + .disabled-btn { + width: 428rpx; + height: 72rpx; + border-radius: 40rpx; + background: #999999; + color: $white; + } + } + + .model-box { + height: 60vh; + + .model-content { + height: 56vh; + } + + .title { + font-size: 36rpx; + font-weight: bold; + color: #333333; + } + + .subtitle { + font-size: 26rpx; + font-weight: 500; + color: #333333; + } + } + \ No newline at end of file diff --git a/pages/index/cart.vue b/pages/index/cart.vue index aba9db49..02c052f1 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -1,207 +1,200 @@ + .cart-content { + margin-top: 70rpx; + + .goods-box { + background-color: #fff; + } + } + } + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index e568e081..ac6e7cad 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -89,4 +89,4 @@ onPageScroll(() => {}); - + \ No newline at end of file diff --git a/pages/order/aftersale/detail.vue b/pages/order/aftersale/detail.vue index 4e57bd98..ddd8269c 100644 --- a/pages/order/aftersale/detail.vue +++ b/pages/order/aftersale/detail.vue @@ -1,357 +1,355 @@ + .aftersale-item { + height: 60rpx; + + .copy-btn { + background: #eeeeee; + color: #333; + border-radius: 20rpx; + width: 75rpx; + height: 40rpx; + font-size: 22rpx; + } + + .item-title { + color: #999; + font-size: 28rpx; + } + + .item-content { + color: #333; + font-size: 28rpx; + } + } + } + + // 底部功能 + .foot_box { + height: 100rpx; + background-color: #fff; + display: flex; + align-items: center; + justify-content: flex-end; + + .btn { + width: 160rpx; + line-height: 60rpx; + background: rgba(238, 238, 238, 1); + border-radius: 30rpx; + padding: 0; + margin-right: 20rpx; + font-size: 26rpx; + + font-weight: 400; + color: rgba(51, 51, 51, 1); + } + } + \ No newline at end of file diff --git a/pages/order/aftersale/list.vue b/pages/order/aftersale/list.vue index d44ee402..4cf824b0 100644 --- a/pages/order/aftersale/list.vue +++ b/pages/order/aftersale/list.vue @@ -1,235 +1,238 @@ + .tool-btn { + width: 160rpx; + height: 60rpx; + background: #f6f6f6; + border-radius: 30rpx; + font-size: 26rpx; + font-weight: 400; + } + } + } + \ No newline at end of file diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index 6a204d75..7f866a4c 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -1,419 +1,414 @@ + .total-num { + color: #333333; + font-family: OPPOSANS; + } + } + + .footer-box { + height: 100rpx; + + .submit-btn { + width: 240rpx; + height: 70rpx; + font-size: 28rpx; + font-weight: 500; + + .goto-pay-text { + line-height: 28rpx; + } + } + + .cancel-btn { + width: 240rpx; + height: 80rpx; + font-size: 26rpx; + background-color: #e5e5e5; + color: $dark-9; + } + } + + .title { + font-size: 36rpx; + font-weight: bold; + color: #333333; + } + + .subtitle { + font-size: 28rpx; + color: #999999; + } + + .cicon-checkbox { + font-size: 36rpx; + color: var(--ui-BG-Main); + } + + .cicon-box { + font-size: 36rpx; + color: #999999; + } + \ No newline at end of file diff --git a/pages/order/detail.vue b/pages/order/detail.vue index d0fa5cde..c6b370fc 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -1,726 +1,692 @@ + .all-rpice-item { + justify-content: flex-end; + align-items: center; + + .title { + font-size: 26rpx; + font-weight: 500; + color: #333333; + line-height: normal; + } + + .all-price { + font-size: 26rpx; + font-family: OPPOSANS; + line-height: normal; + color: $red; + } + } + } + + // 底部 + .footer-box { + height: 100rpx; + width: 100%; + box-sizing: border-box; + border-radius: 10rpx; + padding-right: 20rpx; + + .cancel-btn { + width: 160rpx; + height: 60rpx; + background: #eeeeee; + border-radius: 30rpx; + margin-right: 20rpx; + font-size: 26rpx; + font-weight: 400; + color: #333333; + } + + .pay-btn { + width: 160rpx; + height: 60rpx; + font-size: 26rpx; + border-radius: 30rpx; + font-weight: 500; + color: #fff; + } + } + \ No newline at end of file diff --git a/pages/order/list.vue b/pages/order/list.vue index 5cb1607d..5cc39aae 100644 --- a/pages/order/list.vue +++ b/pages/order/list.vue @@ -7,7 +7,7 @@ + :key="order.id" @tap="onOrderDetail(order.id)"> 订单号:{{ order.no }} {{ @@ -15,7 +15,8 @@ }} - --> - - - - - - - + + + + + + + + + + .sync-wxaddress { + flex: 1; + line-height: 80rpx; + background: $white; + border-radius: 80rpx; + font-size: 30rpx; + font-weight: 500; + color: $dark-6; + margin-right: 18rpx; + } + } + \ No newline at end of file diff --git a/pages/user/wallet/money.vue b/pages/user/wallet/money.vue index 94903b84..3b6a9143 100644 --- a/pages/user/wallet/money.vue +++ b/pages/user/wallet/money.vue @@ -20,7 +20,7 @@ - - - 总收入¥{{ }} - 总支出¥{{ }} + + @@ -45,7 +45,8 @@ {{ item.title }} - +{{ item.amount||item.price }} + +{{ item.amount||item.price }} {{ item.price }} @@ -133,7 +134,7 @@ income: res.data.income, expense: res.data.expense, }; - console.log('交易数据',state.pagination) + console.log('交易数据', state.pagination) if (state.pagination.current_page < state.pagination.last_page) { state.loadStatus = 'more'; } else { diff --git a/pages/user/wallet/score.vue b/pages/user/wallet/score.vue index 74c02ed0..fc75d75a 100644 --- a/pages/user/wallet/score.vue +++ b/pages/user/wallet/score.vue @@ -1,281 +1,279 @@ + .minus { + font-size: 30rpx; + + font-weight: 500; + color: $dark-3; + } + } + } + \ No newline at end of file diff --git a/sheep/api/cart.js b/sheep/api/cart.js index a319ec55..f4aacaa3 100644 --- a/sheep/api/cart.js +++ b/sheep/api/cart.js @@ -2,41 +2,41 @@ import request from '@/sheep/request'; import request2 from '@/sheep/request2'; export default { - list: (data) => - request2({ - url: 'trade/cart/list', - method: 'GET', - custom: { - showLoading: false, - auth: true, - }, - }), - append: (data) => - request({ - url: 'cart', - method: 'POST', - custom: { - showSuccess: true, - successMsg: '已添加到购物车~', - }, - data: { - ...data, - type: 'inc', - }, - }), - // 删除购物车 - delete: (ids) => - request2({ - url: 'trade/cart/delete?ids=' + ids, - method: 'DELETE', - }), - update: (data) => - request2({ - url: 'trade/cart/update-count', - method: 'PUT', - data: { - ...data, - type: 'cover', - }, - }), -}; + list: (data) => + request2({ + url: 'trade/cart/list', + method: 'GET', + custom: { + showLoading: false, + auth: true, + }, + }), + append: (data) => + request({ + url: 'cart', + method: 'POST', + custom: { + showSuccess: true, + successMsg: '已添加到购物车~', + }, + data: { + ...data, + type: 'inc', + }, + }), + // 删除购物车 + delete: (ids) => + request2({ + url: 'trade/cart/delete?ids=' + ids, + method: 'DELETE', + }), + update: (data) => + request2({ + url: 'trade/cart/update-count', + method: 'PUT', + data: { + ...data, + type: 'cover', + }, + }), +}; \ No newline at end of file diff --git a/sheep/api/coupon.js b/sheep/api/coupon.js index 4c4d21bc..3f5e8e6e 100644 --- a/sheep/api/coupon.js +++ b/sheep/api/coupon.js @@ -1,38 +1,45 @@ import request from '@/sheep/request'; +import request2 from '@/sheep/request2'; export default { - // 我的拼团 - list: (params) => - request({ - url: 'coupon', - method: 'GET', - params, - custom: { - showLoading: false, - }, - }), - userCoupon: (params) => - request({ - url: 'user/coupon', - method: 'GET', - params, - }), - detail: (id, user_coupon_id) => - request({ - url: 'coupon/' + id, - method: 'GET', - params: { - user_coupon_id, - }, - }), - get: (id) => - request({ - url: 'coupon/get/' + id, - method: 'POST', - }), - listByGoods: (id) => - request({ - url: 'coupon/listByGoods/' + id, - method: 'GET', - }), -}; + // 我的拼团 + list: (params) => + request({ + url: 'coupon', + method: 'GET', + params, + custom: { + showLoading: false, + }, + }), + userCoupon: (params) => + request2({ + url: 'promotion/coupon/page', + method: 'GET', + params, + }), + // userCoupon: (params) => + // request({ + // url: 'user/coupon', + // method: 'GET', + // params, + // }), + detail: (id, user_coupon_id) => + request({ + url: 'coupon/' + id, + method: 'GET', + params: { + user_coupon_id, + }, + }), + get: (id) => + request({ + url: 'coupon/get/' + id, + method: 'POST', + }), + listByGoods: (id) => + request({ + url: 'coupon/listByGoods/' + id, + method: 'GET', + }), +}; \ No newline at end of file diff --git a/sheep/api/order.js b/sheep/api/order.js index acb16418..8fb48cad 100644 --- a/sheep/api/order.js +++ b/sheep/api/order.js @@ -2,148 +2,191 @@ import request from '@/sheep/request'; import request2 from '@/sheep/request2'; export default { - // 订单详情 - detail: (id,params) => - request({ - url: 'order/order/' + id, - method: 'GET', - params, - }), - // 发票详情 - invoice: (id) => - request({ - url: 'order/invoice/' + id, - method: 'GET', - }), - // 获取支付结果 - payResult: (id) => - request({ - url: 'order/order/' + id, - method: 'GET', - custom: { - showLoading: false, - }, - }), - itemDetail: (id,itemId) => - request({ - url: 'order/order/itemDetail/'+ id + '/' + itemId, - method: 'GET', - custom: { - showLoading: false, - }, - }), - // 订单列表 - list: (params) => - request2({ - url: 'trade/order/page', - method: 'GET', - params, - custom: { - showLoading: false, - }, - }), - // list: (params) => - // request({ - // url: 'order/order', - // method: 'GET', - // params, - // custom: { - // showLoading: false, - // }, - // }), - // 计算订单信息 - calc: (data) => - request({ - url: 'order/order/calc', - method: 'POST', - data, - }), - // 创建订单 - create: (data) => - request({ - url: 'order/order/create', - method: 'POST', - data, - }), - //订单可用优惠券 - coupons: (data) => - request({ - url: 'order/order/coupons', - method: 'POST', - data, - }), - // 确认收货 - confirm: (id) => - request({ - url: 'order/order/confirm/' + id, - method: 'PUT', - }), - // 评价订单 - comment: (id, data) => - request({ - url: 'order/order/comment/' + id, - method: 'POST', - data, - }), - // 申请退款 - applyRefund: (id) => - request({ - url: 'order/order/applyRefund/' + id, - method: 'PUT', - }), - // 取消订单 - cancel: (id) => - request({ - url: 'order/order/cancel/' + id, - method: 'PUT', - }), - // 删除订单 - delete: (id) => - request({ - url: 'order/order/' + id, - method: 'DELETE', - }), - // 售后 - aftersale: { - // 申请售后 - apply: (data) => - request({ - url: 'order/aftersale', - method: 'POST', - data, - }), - list: (params) => - request({ - url: 'order/aftersale', - method: 'GET', - params, - custom: { - showLoading: false, - }, - }), - //取消售后 - cancel: (id) => - request({ - url: 'order/aftersale/cancel/' + id, - method: 'PUT', - }), - //删除售后单 - delete: (id) => - request({ - url: 'order/aftersale/' + id, - method: 'DELETE', - }), - // 售后详情 - detail: (id) => - request({ - url: 'order/aftersale/' + id, - method: 'GET', - }), - }, - //订单包裹 - express: (id, orderId) => - request({ - url: 'order/express/' + id + `${orderId ? '/' + orderId : ''}`, - method: 'GET', - }), -}; + // 订单详情 + detail: (id, params) => + request2({ + url: 'trade/order/get-detail?id=' + id, + method: 'GET', + params, + }), + // detail: (id, params) => + // request({ + // url: 'order/order/' + id, + // method: 'GET', + // params, + // }), + // 发票详情 + invoice: (id) => + request({ + url: 'order/invoice/' + id, + method: 'GET', + }), + // 获取支付结果 + payResult: (id) => + request({ + url: 'order/order/' + id, + method: 'GET', + custom: { + showLoading: false, + }, + }), + itemDetail: (id, itemId) => + request({ + url: 'order/order/itemDetail/' + id + '/' + itemId, + method: 'GET', + custom: { + showLoading: false, + }, + }), + // 订单列表 + list: (params) => + request2({ + url: 'trade/order/page', + method: 'GET', + params, + custom: { + showLoading: false, + }, + }), + // list: (params) => + // request({ + // url: 'order/order', + // method: 'GET', + // params, + // custom: { + // showLoading: false, + // }, + // }), + // 计算订单信息 + calc: (data) => { + const data2 = { + ...data, + } + // 解决 SpringMVC 接受 List 参数的问题 + delete data2.items + for (let i = 0; i < data.items.length; i++) { + // data2['items[' + i + '' + '].skuId'] = data.items[i].skuId + ''; + // data2['items[' + i + '' + '].count'] = data.items[i].count + ''; + // data2['items[' + i + '' + '].cartId'] = data.items[i].cartId + ''; + data2['items' + `%5B${i}%5D` + '.skuId'] = data.items[i].skuId + ''; + data2['items' + `%5B${i}%5D` + '.count'] = data.items[i].count + ''; + data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + ''; + } + console.log(data2, '对比数据') + return request2({ + url: 'trade/order/settlement', + method: 'GET', + // data, + params: data2 + }) + }, + // calc: (data) => + // request({ + // url: 'order/order/calc', + // method: 'POST', + // data, + // }), + // 创建订单 + create: (data) => + request({ + url: 'order/order/create', + method: 'POST', + data, + }), + //订单可用优惠券 + coupons: (data) => + request({ + url: 'order/order/coupons', + method: 'POST', + data, + }), + // 确认收货 + confirm: (id) => + request({ + url: 'order/order/confirm/' + id, + method: 'PUT', + }), + // 评价订单 + comment: (data) => + request2({ + url: 'trade/order/item/create-comment', + method: 'POST', + data, + }), + // comment: (id, data) => + // request({ + // url: 'order/order/comment/' + id, + // method: 'POST', + // data, + // }), + // 申请退款 + applyRefund: (id) => + request({ + url: 'order/order/applyRefund/' + id, + method: 'PUT', + }), + // 取消订单 + cancel: (id) => + request({ + url: 'order/order/cancel/' + id, + method: 'PUT', + }), + // 删除订单 + delete: (id) => + request({ + url: 'order/order/' + id, + method: 'DELETE', + }), + // 售后 + aftersale: { + // 申请售后 + apply: (data) => + request({ + url: 'order/aftersale', + method: 'POST', + data, + }), + list: (params) => + request2({ + url: 'trade/after-sale/page', + method: 'GET', + params, + custom: { + showLoading: false, + }, + }), + // list: (params) => + // request({ + // url: 'order/aftersale', + // method: 'GET', + // params, + // custom: { + // showLoading: false, + // }, + // }), + //取消售后 + cancel: (id) => + request({ + url: 'order/aftersale/cancel/' + id, + method: 'PUT', + }), + //删除售后单 + delete: (id) => + request({ + url: 'order/aftersale/' + id, + method: 'DELETE', + }), + // 售后详情 + detail: (id) => + request2({ + url: 'trade/after-sale/get?id=' + id, + method: 'GET', + }), + }, + //订单包裹 + express: (id, orderId) => + request({ + url: 'order/express/' + id + `${orderId ? '/' + orderId : ''}`, + method: 'GET', + }), +}; \ No newline at end of file diff --git a/sheep/api/user.js b/sheep/api/user.js index 3f16f237..fb3e809c 100644 --- a/sheep/api/user.js +++ b/sheep/api/user.js @@ -3,6 +3,15 @@ import request2 from '@/sheep/request2'; import $platform from '@/sheep/platform'; export default { + getUnused: () => + request2({ + url: 'promotion/coupon/get-unused-count', + method: 'GET', + custom: { + showLoading: false, + auth: true, + }, + }), profile: () => request2({ url: 'member/user/get', @@ -187,9 +196,17 @@ export default { }), address: { + // default: () => + // request({ + // url: 'user/address/default', + // method: 'GET', + // custom: { + // showError: false, + // }, + // }), default: () => - request({ - url: 'user/address/default', + request2({ + url: 'member/address/get-default', method: 'GET', custom: { showError: false, @@ -225,7 +242,7 @@ export default { // showSuccess: true, // }, // }), - update: ( data) => + update: (data) => request2({ url: 'member/address/update', method: 'PUT', @@ -325,7 +342,7 @@ export default { url: 'product/favorite/delete-list', method: 'DELETE', data: { - spuIds: id.split(',').map(item=>item*1), + spuIds: id.split(',').map(item => item * 1), // spuIds: id.split(',').join(','), }, custom: { @@ -367,18 +384,27 @@ export default { wallet: { log: (params) => request2({ + // url: 'member/point/record/page', url: 'pay/wallet-transaction/page', method: 'GET', params, custom: {}, }), - // log: (params) => - // request({ - // url: '/user/api/walletLog', - // method: 'GET', - // params, - // custom: {}, - // }), + log2: (params) => + request2({ + url: 'member/point/record/page', + // url: 'pay/wallet-transaction/page', + method: 'GET', + params, + custom: {}, + }), + // log: (params) => + // request({ + // url: '/user/api/walletLog', + // method: 'GET', + // params, + // custom: {}, + // }), }, account: { info: (params) => diff --git a/sheep/components/s-coupon-card/s-coupon-card.vue b/sheep/components/s-coupon-card/s-coupon-card.vue index 2e0d2209..5be18c85 100644 --- a/sheep/components/s-coupon-card/s-coupon-card.vue +++ b/sheep/components/s-coupon-card/s-coupon-card.vue @@ -1,80 +1,78 @@ + .ss-coupon-menu-wrap { + .menu-item { + height: 160rpx; + + .menu-title { + font-size: 24rpx; + line-height: 24rpx; + color: #333333; + } + + .item-icon { + width: 44rpx; + height: 44rpx; + } + } + + .menu-wallet { + width: 144rpx; + } + } + \ No newline at end of file diff --git a/sheep/components/s-coupon-list/s-coupon-list.vue b/sheep/components/s-coupon-list/s-coupon-list.vue index b22ed98d..648b32da 100644 --- a/sheep/components/s-coupon-list/s-coupon-list.vue +++ b/sheep/components/s-coupon-list/s-coupon-list.vue @@ -1,192 +1,195 @@ + .info-color { + color: #333; + } + + .subtitle-color { + color: #666; + } + + .disabled-color { + color: #999; + } + + .content { + width: 100%; + background: #fff; + border-radius: 20rpx 20rpx 0 0; + -webkit-mask: radial-gradient(circle at 12rpx 100%, #0000 12rpx, red 0) -12rpx; + box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04); + + .tag { + width: 100rpx; + + color: #fff; + height: 40rpx; + font-size: 24rpx; + border-radius: 20rpx 0 20rpx 0; + } + + .title { + padding-bottom: 22rpx; + border-bottom: 2rpx dashed #d3d3d3; + + .value-text { + font-size: 32rpx; + font-weight: 600; + } + + .sellby-text { + font-size: 24rpx; + font-weight: 400; + } + + .value-price { + font-size: 64rpx; + font-weight: 500; + line-height: normal; + font-family: OPPOSANS; + } + + .value-reduce { + line-height: normal; + font-size: 32rpx; + } + + .value-discount { + line-height: normal; + font-size: 28rpx; + } + + .value-enough { + font-size: 24rpx; + font-weight: 400; + font-family: OPPOSANS; + } + } + } + + .desc { + width: 100%; + background: #fff; + -webkit-mask: radial-gradient(circle at 12rpx 0%, #0000 12rpx, red 0) -12rpx; + box-shadow: rgba(#000, 0.1); + box-sizing: border-box; + padding: 24rpx 30rpx; + box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04); + border-radius: 0 0 20rpx 20rpx; + + .desc-title { + font-size: 24rpx; + color: #999; + font-weight: 400; + } + } + + .price-text { + color: #ff0000; + } + \ No newline at end of file diff --git a/sheep/components/s-select-sku/s-select-sku.vue b/sheep/components/s-select-sku/s-select-sku.vue index dc846d7c..7819b900 100644 --- a/sheep/components/s-select-sku/s-select-sku.vue +++ b/sheep/components/s-select-sku/s-select-sku.vue @@ -1,476 +1,458 @@ + .disabled-btn { + font-weight: 400; + color: #c6c6c6; + background: #f8f8f8; + } + } + } + } + \ No newline at end of file diff --git a/sheep/components/s-user-card/s-user-card.vue b/sheep/components/s-user-card/s-user-card.vue index a0257c39..2f007591 100644 --- a/sheep/components/s-user-card/s-user-card.vue +++ b/sheep/components/s-user-card/s-user-card.vue @@ -1,34 +1,31 @@ + .bind-btn { + width: 100rpx; + height: 50rpx; + background: #ff6100; + border-radius: 25rpx; + font-size: 24rpx; + font-weight: 500; + color: #ffffff; + } + } + \ No newline at end of file diff --git a/sheep/components/s-wallet-card/s-wallet-card.vue b/sheep/components/s-wallet-card/s-wallet-card.vue index 3bb6ca9a..25d6c1c1 100644 --- a/sheep/components/s-wallet-card/s-wallet-card.vue +++ b/sheep/components/s-wallet-card/s-wallet-card.vue @@ -1,4 +1,16 @@ + .value-text { + font-size: 28rpx; + color: #000000; + line-height: 28rpx; + vertical-align: text-bottom; + font-family: OPPOSANS; + } + + .unit-text { + font-size: 24rpx; + color: #343434; + line-height: 24rpx; + } + } + } + } + \ No newline at end of file diff --git a/sheep/request/index.js b/sheep/request/index.js index 8fb44616..94d5bc08 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -4,213 +4,218 @@ */ import Request from 'luch-request'; -import { baseUrl, apiPath } from '@/sheep/config'; +import { + baseUrl, + apiPath +} from '@/sheep/config'; import $store from '@/sheep/store'; import $platform from '@/sheep/platform'; -import { showAuthModal } from '@/sheep/hooks/useModal'; +import { + showAuthModal +} from '@/sheep/hooks/useModal'; const options = { - // 显示操作成功消息 默认不显示 - showSuccess: false, - // 成功提醒 默认使用后端返回值 - successMsg: '', - // 显示失败消息 默认显示 - showError: true, - // 失败提醒 默认使用后端返回信息 - errorMsg: '', - // 显示请求时loading模态框 默认显示 - showLoading: true, - // loading提醒文字 - loadingMsg: '加载中', - // 需要授权才能请求 默认放开 - auth: false, - // ... + // 显示操作成功消息 默认不显示 + showSuccess: false, + // 成功提醒 默认使用后端返回值 + successMsg: '', + // 显示失败消息 默认显示 + showError: true, + // 失败提醒 默认使用后端返回信息 + errorMsg: '', + // 显示请求时loading模态框 默认显示 + showLoading: true, + // loading提醒文字 + loadingMsg: '加载中', + // 需要授权才能请求 默认放开 + auth: false, + // ... }; // Loading全局实例 let LoadingInstance = { - target: null, - count: 0, + target: null, + count: 0, }; /** * 关闭loading */ function closeLoading() { - if (LoadingInstance.count > 0) LoadingInstance.count--; - if (LoadingInstance.count === 0) uni.hideLoading(); + if (LoadingInstance.count > 0) LoadingInstance.count--; + if (LoadingInstance.count === 0) uni.hideLoading(); } /** * @description 请求基础配置 可直接使用访问自定义请求 */ const http = new Request({ - baseURL: baseUrl, - timeout: 8000, - method: 'GET', - header: { - Accept: 'text/json', - 'Content-Type': 'application/json;charset=UTF-8', - platform: $platform.name, - }, - // #ifdef APP-PLUS - sslVerify: false, - // #endif - // #ifdef H5 - // 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) - withCredentials: false, - // #endif - custom: options, + baseURL: baseUrl, + timeout: 8000, + method: 'GET', + header: { + Accept: 'text/json', + 'Content-Type': 'application/json;charset=UTF-8', + platform: $platform.name, + }, + // #ifdef APP-PLUS + sslVerify: false, + // #endif + // #ifdef H5 + // 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) + withCredentials: false, + // #endif + custom: options, }); /** * @description 请求拦截器 */ http.interceptors.request.use( - (config) => { - if (config.custom.auth && !$store('user').isLogin) { - showAuthModal(); - return Promise.reject(); - } - if (config.custom.showLoading) { - LoadingInstance.count++; - LoadingInstance.count === 1 && - uni.showLoading({ - title: config.custom.loadingMsg, - mask: true, - fail: () => { - uni.hideLoading(); - }, - }); - } - const token = uni.getStorageSync('token'); - if (token) config.header['Authorization'] = token; - // TODO 芋艿:特殊处理 - if (config.url.indexOf('/app-api/') !== -1) { - config.header['Accept'] = '*/*' - config.header['tenant-id'] = '1'; - config.header['Authorization'] = 'Bearer test247'; - } - return config; - }, - (error) => { - return Promise.reject(error); - }, + (config) => { + if (config.custom.auth && !$store('user').isLogin) { + showAuthModal(); + return Promise.reject(); + } + if (config.custom.showLoading) { + LoadingInstance.count++; + LoadingInstance.count === 1 && + uni.showLoading({ + title: config.custom.loadingMsg, + mask: true, + fail: () => { + uni.hideLoading(); + }, + }); + } + const token = uni.getStorageSync('token'); + if (token) config.header['Authorization'] = token; + // TODO 芋艿:特殊处理 + if (config.url.indexOf('/app-api/') !== -1) { + config.header['Accept'] = '*/*' + config.header['tenant-id'] = '1'; + config.header['Authorization'] = 'Bearer test247'; + } + return config; + }, + (error) => { + return Promise.reject(error); + }, ); /** * @description 响应拦截器 */ http.interceptors.response.use( - (response) => { - // 自动设置登陆令牌 - if (response.header.authorization || response.header.Authorization) { - $store('user').setToken(response.header.authorization || response.header.Authorization); - } + (response) => { + // 自动设置登陆令牌 + if (response.header.authorization || response.header.Authorization) { + $store('user').setToken(response.header.authorization || response.header.Authorization); + } - response.config.custom.showLoading && closeLoading(); - if (response.data.error !== 0) { - if (response.config.custom.showError) - uni.showToast({ - title: response.data.msg || '服务器开小差啦,请稍后再试~', - icon: 'none', - mask: true, - }); - return Promise.resolve(response.data); - } - if ( - response.data.error === 0 && - response.data.msg !== '' && - response.config.custom.showSuccess - ) { - uni.showToast({ - title: response.config.custom.successMsg || response.data.msg, - icon: 'none', - }); - } - return Promise.resolve(response.data); - }, - (error) => { - const userStore = $store('user'); - const isLogin = userStore.isLogin; - let errorMessage = '网络请求出错'; - if (error !== undefined) { - switch (error.statusCode) { - case 400: - errorMessage = '请求错误'; - break; - case 401: - if (isLogin) { - errorMessage = '您的登陆已过期'; - } else { - errorMessage = '请先登录'; - } - userStore.logout(true); - showAuthModal(); - break; - case 403: - errorMessage = '拒绝访问'; - break; - case 404: - errorMessage = '请求出错'; - break; - case 408: - errorMessage = '请求超时'; - break; - case 429: - errorMessage = '请求频繁, 请稍后再访问'; - break; - case 500: - errorMessage = '服务器开小差啦,请稍后再试~'; - break; - case 501: - errorMessage = '服务未实现'; - break; - case 502: - errorMessage = '网络错误'; - break; - case 503: - errorMessage = '服务不可用'; - break; - case 504: - errorMessage = '网络超时'; - break; - case 505: - errorMessage = 'HTTP版本不受支持'; - break; - } - if (error.errMsg.includes('timeout')) errorMessage = '请求超时'; - // #ifdef H5 - if (error.errMsg.includes('Network')) - errorMessage = window.navigator.onLine ? '服务器异常' : '请检查您的网络连接'; - // #endif - } + response.config.custom.showLoading && closeLoading(); + if (response.data.error !== 0) { + if (response.config.custom.showError) + uni.showToast({ + title: response.data.msg || '服务器开小差啦,请稍后再试~', + icon: 'none', + mask: true, + }); + return Promise.resolve(response.data); + } + if ( + response.data.error === 0 && + response.data.msg !== '' && + response.config.custom.showSuccess + ) { + uni.showToast({ + title: response.config.custom.successMsg || response.data.msg, + icon: 'none', + }); + } + return Promise.resolve(response.data); + }, + (error) => { + const userStore = $store('user'); + const isLogin = userStore.isLogin; + let errorMessage = '网络请求出错'; + if (error !== undefined) { + switch (error.statusCode) { + case 400: + errorMessage = '请求错误'; + break; + case 401: + if (isLogin) { + errorMessage = '您的登陆已过期'; + } else { + errorMessage = '请先登录'; + } + userStore.logout(true); + showAuthModal(); + break; + case 403: + errorMessage = '拒绝访问'; + break; + case 404: + errorMessage = '请求出错'; + break; + case 408: + errorMessage = '请求超时'; + break; + case 429: + errorMessage = '请求频繁, 请稍后再访问'; + break; + case 500: + errorMessage = '服务器开小差啦,请稍后再试~'; + break; + case 501: + errorMessage = '服务未实现'; + break; + case 502: + errorMessage = '网络错误'; + break; + case 503: + errorMessage = '服务不可用'; + break; + case 504: + errorMessage = '网络超时'; + break; + case 505: + errorMessage = 'HTTP版本不受支持'; + break; + } + if (error.errMsg.includes('timeout')) errorMessage = '请求超时'; + // #ifdef H5 + if (error.errMsg.includes('Network')) + errorMessage = window.navigator.onLine ? '服务器异常' : '请检查您的网络连接'; + // #endif + } - if (error && error.config) { - if (error.config.custom.showError === false) { - uni.showToast({ - title: error.data?.msg || errorMessage, - icon: 'none', - mask: true, - }); - } - error.config.custom.showLoading && closeLoading(); - } + if (error && error.config) { + if (error.config.custom.showError === false) { + uni.showToast({ + title: error.data?.msg || errorMessage, + icon: 'none', + mask: true, + }); + } + error.config.custom.showLoading && closeLoading(); + } - return false; - }, + return false; + }, ); const request = (config) => { - if (config.url[0] !== '/') { - config.url = apiPath + config.url; - } - // TODO 芋艿:额外拼接 - if (config.url.indexOf('/app-api/') >= 0) { - config.url = 'http://api-dashboard.yudao.iocoder.cn' + config.url; // 调用【云端】 - // config.url = 'http://127.0.0.1:48080' + config.url; // 调用【本地】 - } - return http.middleware(config); + if (config.url[0] !== '/') { + config.url = apiPath + config.url; + } + // TODO 芋艿:额外拼接 + if (config.url.indexOf('/app-api/') >= 0) { + config.url = 'http://api-dashboard.yudao.iocoder.cn' + config.url; // 调用【云端】 + // config.url = 'http://127.0.0.1:48080' + config.url; // 调用【本地】 + } + return http.middleware(config); }; -export default request; +export default request; \ No newline at end of file diff --git a/sheep/store/user.js b/sheep/store/user.js index 0b329e79..f460565f 100644 --- a/sheep/store/user.js +++ b/sheep/store/user.js @@ -1,168 +1,194 @@ -import { defineStore } from 'pinia'; +import { + defineStore +} from 'pinia'; import userApi from '@/sheep/api/user'; import commissionApi from '@/sheep/api/commission'; import $share from '@/sheep/platform/share'; -import { isEmpty, cloneDeep, clone } from 'lodash'; +import { + isEmpty, + cloneDeep, + clone +} from 'lodash'; import cart from './cart'; import app from './app'; -import { showAuthModal } from '@/sheep/hooks/useModal'; +import { + showAuthModal +} from '@/sheep/hooks/useModal'; // 默认用户信息 const defaultUserInfo = { - avatar: '', // 头像 - nickname: '', // 昵称 - gender: 0, // 性别 - mobile: '', // 手机号 - money: '--', // 余额 - commission: '--', // 佣金 - score: '--', // 积分 - verification: {}, // 认证字段 + avatar: '', // 头像 + nickname: '', // 昵称 + gender: 0, // 性别 + mobile: '', // 手机号 + money: '--', // 余额 + commission: '--', // 佣金 + score: '--', // 积分 + verification: {}, // 认证字段 }; // 默认订单、优惠券等其他资产信息 const defaultNumData = { - coupons_num: '--', - order_num: { - aftersale: 0, - nocomment: 0, - noget: 0, - nosend: 0, - unpaid: 0, - }, + coupons_num: '--', + order_num: { + aftersale: 0, + nocomment: 0, + noget: 0, + nosend: 0, + unpaid: 0, + }, }; const user = defineStore({ - id: 'user', - state: () => ({ - userInfo: clone(defaultUserInfo), // 用户信息 - isLogin: !!uni.getStorageSync('token'), // 登录状态 - numData: cloneDeep(defaultNumData), // 用户其他数据 - agentInfo: {}, // 分销商信息 - lastUpdateTime: 0, // 上次更新时间 - }), + id: 'user', + state: () => ({ + userInfo: clone(defaultUserInfo), // 用户信息 + isLogin: !!uni.getStorageSync('token'), // 登录状态 + numData: cloneDeep(defaultNumData), // 用户其他数据 + agentInfo: {}, // 分销商信息 + lastUpdateTime: 0, // 上次更新时间 + }), - actions: { - // 获取个人信息 - async getInfo() { - const { code, data } = await userApi.profile(); - // 为了兼容 获取用户余额 可能还会用到其他参数 - const { code:code2, data:data2 } = await userApi.balance(); - if (code !== 0||code2!=0) return; - data.money=data2.balance/100; - this.userInfo = data; + actions: { + // 获取个人信息 + async getInfo() { + const { + code, + data + } = await userApi.profile(); - return Promise.resolve(data); - }, + // 为了兼容 获取用户余额 可能还会用到其他参数 + // 优惠券数量,积分数量 应该在这里 + const { + code: code2, + data: data2 + } = await userApi.balance(); + if (code !== 0 || code2 != 0) return; + data.money = data2.balance / 100; + this.userInfo = data; + console.log(data2, '信息') + return Promise.resolve(data); + }, - // 获取分销商信息 - async getAgentInfo() { - const res = await commissionApi.agent(); - if (res.error === 0) { - this.agentInfo = res.data; - } - return Promise.resolve(res); - }, + // 获取分销商信息 + async getAgentInfo() { + const res = await commissionApi.agent(); + if (res.error === 0) { + this.agentInfo = res.data; + } + return Promise.resolve(res); + }, - // 获取订单、优惠券等其他资产信息 - async getNumData() { - const { code, data } = await userApi.data(); - const data2 = await userApi.data2(); - if (code === 0&&data2.code===0) { - console.log('订单数据',data); - this.numData = {order_num:{ - noget:data.deliveredCount, - unpaid:data.unpaidCount, - nocomment:data.uncommentedCount, - aftersale:data2.data - }}; - } - }, + // 获取订单、优惠券等其他资产信息 + async getNumData() { + const { + code, + data + } = await userApi.data(); + const data2 = await userApi.data2(); + let data3 = await userApi.getUnused(); + console.log(data3.data, '优惠券') + if (code === 0 && data2.code === 0) { + console.log('订单数据', data); + this.numData = { + coupons_num: data3.data, + order_num: { + noget: data.deliveredCount, + unpaid: data.unpaidCount, + nocomment: data.uncommentedCount, + aftersale: data2.data + } + }; + } + }, - // 添加分享记录 - async addShareLog(params) { - const { error } = await userApi.addShareLog(params); - if (error === 0) uni.removeStorageSync('shareLog'); - }, + // 添加分享记录 + async addShareLog(params) { + const { + error + } = await userApi.addShareLog(params); + if (error === 0) uni.removeStorageSync('shareLog'); + }, - // 设置token - setToken(token = '') { - if (token === '') { - this.isLogin = false; - uni.removeStorageSync('token'); - } else { - this.isLogin = true; - uni.setStorageSync('token', token); - this.loginAfter(); - } - return this.isLogin; - }, + // 设置token + setToken(token = '') { + if (token === '') { + this.isLogin = false; + uni.removeStorageSync('token'); + } else { + this.isLogin = true; + uni.setStorageSync('token', token); + this.loginAfter(); + } + return this.isLogin; + }, - // 更新用户相关信息 (手动限流 5秒之内不刷新) - async updateUserData() { - if (!this.isLogin) { - this.resetUserData(); - return; - } - const nowTime = new Date().getTime(); - if (this.lastUpdateTime + 5000 > nowTime) return; - await this.getInfo(); - this.getNumData(); - this.lastUpdateTime = nowTime; - return this.userInfo; - }, + // 更新用户相关信息 (手动限流 5秒之内不刷新) + async updateUserData() { + if (!this.isLogin) { + this.resetUserData(); + return; + } + const nowTime = new Date().getTime(); + if (this.lastUpdateTime + 5000 > nowTime) return; + await this.getInfo(); + this.getNumData(); + this.lastUpdateTime = nowTime; + return this.userInfo; + }, - // 重置用户默认数据 - resetUserData() { - this.setToken(); - this.userInfo = clone(defaultUserInfo); - this.numData = cloneDeep(defaultNumData); - this.agentInfo = {}; - cart().emptyList(); - }, + // 重置用户默认数据 + resetUserData() { + this.setToken(); + this.userInfo = clone(defaultUserInfo); + this.numData = cloneDeep(defaultNumData); + this.agentInfo = {}; + cart().emptyList(); + }, - // 登录后 - async loginAfter() { - await this.updateUserData(); - cart().getList(); - // 登录后设置全局分享参数 - $share.getShareInfo(); - // 提醒绑定手机号 - if (app().platform.bind_mobile && !this.userInfo.verification?.mobile) { - showAuthModal('changeMobile'); - } + // 登录后 + async loginAfter() { + await this.updateUserData(); + cart().getList(); + // 登录后设置全局分享参数 + $share.getShareInfo(); + // 提醒绑定手机号 + // if (app().platform.bind_mobile && !this.userInfo.verification?.mobile) { + // showAuthModal('changeMobile'); + // } - // 添加分享记录 - const shareLog = uni.getStorageSync('shareLog'); - if (!isEmpty(shareLog)) { - this.addShareLog({ - ...shareLog, - }); - } - }, + // 添加分享记录 + const shareLog = uni.getStorageSync('shareLog'); + if (!isEmpty(shareLog)) { + this.addShareLog({ + ...shareLog, + }); + } + }, - // 登出 - async logout(force = false) { - if (!force) { - const { error } = await userApi.logout(); - if (error === 0) { - this.resetUserData(); - } - } - if (force) { - this.resetUserData(); - } + // 登出 + async logout(force = false) { + if (!force) { + const { + error + } = await userApi.logout(); + if (error === 0) { + this.resetUserData(); + } + } + if (force) { + this.resetUserData(); + } - return !this.isLogin; - }, - }, - persist: { - enabled: true, - strategies: [ - { - key: 'user-store', - }, - ], - }, + return !this.isLogin; + }, + }, + persist: { + enabled: true, + strategies: [{ + key: 'user-store', + }, ], + }, }); -export default user; +export default user; \ No newline at end of file