From ef26268c8e7719a194516a53b22249199e703984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD=E6=97=A5=E6=99=9A=E9=A3=8E?= <1811466536@qq.com> Date: Mon, 11 Dec 2023 17:42:50 +0800 Subject: [PATCH] =?UTF-8?q?s-coupon-get.vue=EF=BC=8Cdetail-tabbar.vue?= =?UTF-8?q?=EF=BC=8C=E8=AF=A6=E6=83=85=E5=8A=A0=E5=85=A5=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=EF=BC=8C=E5=85=B6=E4=BB=96=E6=A8=A1=E5=9D=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/coupon/list.vue | 12 +- .../goods/components/detail/detail-tabbar.vue | 304 ++- pages/goods/index.vue | 147 +- pages/order/confirm.vue | 2 +- sheep/api/cart.js | 19 +- sheep/api/coupon.js | 15 +- sheep/api/goods.js | 152 +- sheep/api/order.js | 22 +- sheep/api/product/comment.js | 28 +- sheep/api/promotion/coupon.js | 44 +- sheep/api/user.js | 168 +- .../components/s-coupon-get/s-coupon-get.vue | 200 +- .../s-coupon-list/s-coupon-list.vue | 8 +- sheep/request2/index.js | 4 +- sheep/store/cart.js | 208 +- .../mp-html/components/mp-html/parser.js | 2264 +++++++++-------- vite.config.js | 6 +- 17 files changed, 1836 insertions(+), 1767 deletions(-) diff --git a/pages/coupon/list.vue b/pages/coupon/list.vue index 4bb02a0e..6f13777a 100644 --- a/pages/coupon/list.vue +++ b/pages/coupon/list.vue @@ -148,11 +148,20 @@ }); if (res.code === 0) { // 拦截修改数据 + let obj2 = { + 2: '折扣', + 1: '满减' + } let obj = { 1: '可用', 2: '已用', 3: '过期' } + let obj3 = { + 1: '已领取', + 2: '已使用', + 3: '已过期' + } res.data.list = res.data.list.map(item => { return { ...item, @@ -160,7 +169,8 @@ amount: (item.discountPrice / 100).toFixed(2), use_start_time: sheep.$helper.timeFormat(item.validStartTime, 'yyyy-mm-dd hh:MM:ss'), use_end_time: sheep.$helper.timeFormat(item.validEndTime, 'yyyy-mm-dd hh:MM:ss'), - status_text: obj[item.status] + status_text: obj[item.status], + type_text: obj2[item.discountType] } }); if (page >= 2) { diff --git a/pages/goods/components/detail/detail-tabbar.vue b/pages/goods/components/detail/detail-tabbar.vue index aec21ede..dbd8dd18 100644 --- a/pages/goods/components/detail/detail-tabbar.vue +++ b/pages/goods/components/detail/detail-tabbar.vue @@ -1,171 +1,165 @@ + .item-icon { + width: 40rpx; + height: 40rpx; + } + + .item-title { + font-size: 20rpx; + font-weight: 500; + line-height: 20rpx; + margin-top: 12rpx; + } + } + } + \ No newline at end of file diff --git a/pages/goods/index.vue b/pages/goods/index.vue index 19601af1..19ab64f4 100644 --- a/pages/goods/index.vue +++ b/pages/goods/index.vue @@ -13,7 +13,7 @@ + dotStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" /> @@ -31,16 +31,17 @@ - -
+ +
- + {{ promos.title }}
- + 领券 @@ -54,15 +55,15 @@ - + @tap="state.showSelectSku = true" /> + + @buy="onBuy" @change="onSkuChange" @close="state.showSelectSku = false" /> @@ -88,25 +89,35 @@ - + + @get="onGet" /> - + + @close="state.showActivityModel = false" /> diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index 7f866a4c..9acae715 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -281,7 +281,7 @@ } onLoad(async (options) => { - console.log(options) + console.log(options, '确认订单启动参数') if (options.data) { state.orderPayload = JSON.parse(options.data); changeConsignee(); diff --git a/sheep/api/cart.js b/sheep/api/cart.js index f4aacaa3..1b1e22ad 100644 --- a/sheep/api/cart.js +++ b/sheep/api/cart.js @@ -12,8 +12,8 @@ export default { }, }), append: (data) => - request({ - url: 'cart', + request2({ + url: '/app-api/trade/cart/add', method: 'POST', custom: { showSuccess: true, @@ -21,9 +21,22 @@ export default { }, data: { ...data, - type: 'inc', + // type: 'inc', }, }), + // append: (data) => + // request({ + // url: 'cart', + // method: 'POST', + // custom: { + // showSuccess: true, + // successMsg: '已添加到购物车~', + // }, + // data: { + // ...data, + // type: 'inc', + // }, + // }), // 删除购物车 delete: (ids) => request2({ diff --git a/sheep/api/coupon.js b/sheep/api/coupon.js index 3f5e8e6e..446af00b 100644 --- a/sheep/api/coupon.js +++ b/sheep/api/coupon.js @@ -33,10 +33,21 @@ export default { }, }), get: (id) => - request({ - url: 'coupon/get/' + id, + request2({ + url: 'promotion/coupon/take', method: 'POST', + data: { + templateId: id + }, + params: { + templateId: id + }, }), + // get: (id) => + // request({ + // url: 'coupon/get/' + id, + // method: 'POST', + // }), listByGoods: (id) => request({ url: 'coupon/listByGoods/' + id, diff --git a/sheep/api/goods.js b/sheep/api/goods.js index 61f422a6..06878f35 100644 --- a/sheep/api/goods.js +++ b/sheep/api/goods.js @@ -2,79 +2,85 @@ import request from '@/sheep/request'; import request2 from '@/sheep/request2'; export default { - // 商品详情 - detail: (id, params = {}) => - request2({ - url: 'product/spu/get-detail?id=' + id, - method: 'GET', - params, - custom: { - showLoading: false, - showError: false, - }, - }), + // 商品详情 + detail: (id, params = {}) => + request({ + url: '/app-api/product/spu/get-detail?id=' + id, + method: 'GET', + params, + custom: { + showLoading: false, + showError: false, + }, + }), - // 商品列表 - list: (params) => - request2({ - url: 'product/spu/page', - method: 'GET', - params, - custom: { - showLoading: false, - showError: false, - }, - }), + // 商品列表 + list: (params) => + request({ + url: '/app-api/product/spu/page', + method: 'GET', + params, + custom: { + showLoading: false, + showError: false, + }, + }), - // 商品查询 - ids: (params = {}) => - request({ - url: 'goods/goods/ids', - method: 'GET', - params, - custom: { - showLoading: false, - showError: false, - }, - }), + // 商品查询 + ids: (params = {}) => + request({ + url: 'goods/goods/ids', + method: 'GET', + params, + custom: { + showLoading: false, + showError: false, + }, + }), - // 商品评价列表 - comment: (id, params = {}) => - request2({ - url: 'product/comment/list?spuId=' + id, - method: 'GET', - params, - custom: { - showLoading: false, - showError: false, - }, - }), - // 商品评价类型 - getType: (id) => - request({ - url: 'goods/comment/getType/' + id, - method: 'GET', - custom: { - showLoading: false, - showError: false, - }, - }), - // 活动商品查询 - // 商品查询 - activity: (params = {}) => - request({ - url: 'goods/goods/activity', - method: 'GET', - params, - custom: { - showLoading: false, - showError: false, - }, - }), - activityList: (params = {}) => - request({ - url: 'goods/goods/activityList', - method: 'GET', - params, - }), -}; + // 商品评价列表 + comment: (id, params = {}) => + request({ + url: '/app-api/product/comment/list?spuId=' + id, + method: 'GET', + params, + custom: { + showLoading: false, + showError: false, + }, + }), + // 商品评价类型 + getType: (id) => + request({ + url: 'goods/comment/getType/' + id, + method: 'GET', + custom: { + showLoading: false, + showError: false, + }, + }), + // 活动商品查询 + // 商品查询 + activity: (params = {}) => + request({ + url: 'goods/goods/activity', + method: 'GET', + params, + custom: { + showLoading: false, + showError: false, + }, + }), + activityList: (params = {}) => + request({ + url: 'goods/goods/activityList', + method: 'GET', + params, + }), + // 检查是否收藏商品 + exits: (id) => + request({ + url: '/app-api/product/favorite/exits?spuId=' + id, + method: 'GET', + }), +}; \ No newline at end of file diff --git a/sheep/api/order.js b/sheep/api/order.js index 8fb48cad..e7bb5e6a 100644 --- a/sheep/api/order.js +++ b/sheep/api/order.js @@ -65,18 +65,24 @@ export default { // 解决 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 + ''; + // 此处转码问题,待解决方案 + // data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + ''; + // data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + ''; + // data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + ''; + + // 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, '对比数据') + console.log(data2, '手动转码的参数') return request2({ url: 'trade/order/settlement', method: 'GET', - // data, + // data: data2, params: data2 }) }, diff --git a/sheep/api/product/comment.js b/sheep/api/product/comment.js index 01ce25c2..02504fe7 100644 --- a/sheep/api/product/comment.js +++ b/sheep/api/product/comment.js @@ -1,18 +1,18 @@ import request from '@/sheep/request'; const CommentApi = { - // 获得商品评价分页 - getCommentPage: (spuId, pageNo, pageSize, type) => { - return request({ - url: '/app-api/product/comment/page', - method: 'GET', - params: { - spuId, - pageNo, - pageSize, - type - }, - }); - }, + // 获得商品评价分页 + getCommentPage: (spuId, pageNo, pageSize, type) => { + return request({ + url: '/app-api/product/comment/page', + method: 'GET', + params: { + spuId, + pageNo, + pageSize, + type + }, + }); + }, }; -export default CommentApi; +export default CommentApi; \ No newline at end of file diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js index 9bdbb19e..b1de2caf 100644 --- a/sheep/api/promotion/coupon.js +++ b/sheep/api/promotion/coupon.js @@ -1,20 +1,30 @@ import request from '@/sheep/request'; +import request2 from '@/sheep/request2'; export default { - // 获得优惠劵模板列表 - getCouponTemplateListByIds: (ids) => { - return request({ - url: '/app-api/promotion/coupon-template/list-by-ids', - method: 'GET', - params: { ids }, - }); - }, - // 获得优惠劵模版列表 - getCouponTemplateList: (spuId, productScope, count) => { - return request({ - url: '/app-api/promotion/coupon-template/list', - method: 'GET', - params: { spuId, productScope, count }, - }); - }, -}; + // 获得优惠劵模板列表 + getCouponTemplateListByIds: (ids) => { + return request({ + url: '/app-api/promotion/coupon-template/list-by-ids', + method: 'GET', + params: { + ids + }, + }); + }, + // 获得优惠劵模版列表 + getCouponTemplateList: (params) => { + return request2({ + url: `promotion/coupon/match-list?price=${params.price}&spuIds=${params.spuIds}&skuIds=${params.skuIds}&categoryIds=${params.categoryIds}`, + method: 'GET', + // params, + }); + }, + // getCouponTemplateList: (spuId, productScope, count) => { + // return request({ + // url: '/app-api/promotion/coupon-template/list', + // method: 'GET', + // params: { spuId, productScope, count }, + // }); + // }, +}; \ No newline at end of file diff --git a/sheep/api/user.js b/sheep/api/user.js index fb3e809c..10efc5aa 100644 --- a/sheep/api/user.js +++ b/sheep/api/user.js @@ -1,11 +1,10 @@ import request from '@/sheep/request'; -import request2 from '@/sheep/request2'; import $platform from '@/sheep/platform'; export default { getUnused: () => - request2({ - url: 'promotion/coupon/get-unused-count', + request({ + url: '/app-api/promotion/coupon/get-unused-count', method: 'GET', custom: { showLoading: false, @@ -13,8 +12,8 @@ export default { }, }), profile: () => - request2({ - url: 'member/user/get', + request({ + url: '/app-api/member/user/get', method: 'GET', custom: { showLoading: false, @@ -22,7 +21,7 @@ export default { }, }), balance: () => - request2({ + request({ url: '/app-api/pay/wallet/get', method: 'GET', custom: { @@ -30,28 +29,9 @@ export default { auth: true, }, }), - // profile: () => - // request({ - // url: '/user/api/user/profile', - // method: 'GET', - // custom: { - // showLoading: false, - // auth: true, - // }, - // }), - // update: (data) => - // request({ - // url: '/user/api/user/update', - // method: 'POST', - // custom: { - // showSuccess: true, - // auth: true, - // }, - // data, - // }), update: (data) => - request2({ - url: 'member/user/update', + request({ + url: '/app-api/member/user/update', method: 'PUT', custom: { showSuccess: true, @@ -196,90 +176,48 @@ export default { }), address: { - // default: () => - // request({ - // url: 'user/address/default', - // method: 'GET', - // custom: { - // showError: false, - // }, - // }), default: () => - request2({ - url: 'member/address/get-default', + request({ + url: '/app-api/member/address/get-default', method: 'GET', custom: { showError: false, }, }), list: () => - request2({ - url: 'member/address/list', + request({ + url: '/app-api/member/address/list', method: 'GET', custom: {}, }), - // list: () => - // request({ - // url: 'user/address', - // method: 'GET', - // custom: {}, - // }), create: (data) => - request2({ - url: 'member/address/create', + request({ + url: '/app-api/member/address/create', method: 'POST', data, custom: { showSuccess: true, }, }), - // create: (data) => - // request({ - // url: 'user/address', - // method: 'POST', - // data, - // custom: { - // showSuccess: true, - // }, - // }), update: (data) => - request2({ - url: 'member/address/update', + request({ + url: '/app-api/member/address/update', method: 'PUT', data, custom: { showSuccess: true, }, }), - // update: (id, data) => - // request({ - // url: 'user/address/' + id, - // method: 'PUT', - // data, - // custom: { - // showSuccess: true, - // }, - // }), detail: (id) => - request2({ - url: 'member/address/get?id=' + id, + request({ + url: '/app-api/member/address/get?id=' + id, method: 'GET', }), - // detail: (id) => - // request({ - // url: 'user/address/' + id, - // method: 'GET', - // }), delete: (id) => - request2({ - url: 'member/address/delete?id=' + id, + request({ + url: '/app-api/member/address/delete?id=' + id, method: 'DELETE', }), - // delete: (id) => - // request({ - // url: 'user/address/' + id, - // method: 'DELETE', - // }), }, invoice: { list: () => @@ -319,17 +257,29 @@ export default { }, favorite: { list: (params) => - request2({ - url: 'product/favorite/page', + request({ + url: '/app-api/product/favorite/page', method: 'GET', params, }), do: (id) => request({ - url: 'user/goodsLog/favorite', + url: '/app-api/product/favorite/create', method: 'POST', data: { - goods_id: id, + spuId: id, + }, + custom: { + showSuccess: true, + auth: true, + }, + }), + dos: (id) => + request({ + url: '/app-api/product/favorite/delete', + method: 'DELETE', + data: { + spuId: id, }, custom: { showSuccess: true, @@ -338,8 +288,8 @@ export default { }), // 取消收藏 cancel: (id) => - request2({ - url: 'product/favorite/delete-list', + request({ + url: '/app-api/product/favorite/delete-list', method: 'DELETE', data: { spuIds: id.split(',').map(item => item * 1), @@ -350,18 +300,6 @@ export default { auth: true, }, }), - // cancel: (id) => - // request({ - // url: 'user/goodsLog/favorite', - // method: 'POST', - // data: { - // goods_ids: id, - // }, - // custom: { - // showSuccess: true, - // auth: true, - // }, - // }), }, view: { list: (params) => @@ -383,28 +321,21 @@ export default { }, wallet: { log: (params) => - request2({ + request({ // url: 'member/point/record/page', - url: 'pay/wallet-transaction/page', + url: '/app-api/pay/wallet-transaction/page', method: 'GET', params, custom: {}, }), log2: (params) => - request2({ - url: 'member/point/record/page', + request({ + url: '/app-api/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) => @@ -429,18 +360,9 @@ export default { }), }, //数量接口 - // data: () => - // request({ - // url: 'user/user/data', - // method: 'GET', - // custom: { - // showLoading: false, - // auth: true, - // }, - // }), data: () => - request2({ - url: 'trade/order/get-count', + request({ + url: '/app-api/trade/order/get-count', method: 'GET', custom: { showLoading: false, @@ -448,8 +370,8 @@ export default { }, }), data2: () => - request2({ - url: 'trade/after-sale/get-applying-count', + request({ + url: '/app-api/trade/after-sale/get-applying-count', method: 'GET', custom: { showLoading: false, diff --git a/sheep/components/s-coupon-get/s-coupon-get.vue b/sheep/components/s-coupon-get/s-coupon-get.vue index bfa9b9bb..7a346a8c 100644 --- a/sheep/components/s-coupon-get/s-coupon-get.vue +++ b/sheep/components/s-coupon-get/s-coupon-get.vue @@ -1,108 +1,104 @@ + .model-box { + height: 60vh; + + .title { + font-size: 36rpx; + height: 80rpx; + font-weight: bold; + color: #333333; + } + + .subtitle { + font-size: 26rpx; + font-weight: 500; + color: #333333; + } + } + + .model-content { + height: 54vh; + } + + .modal-footer { + width: 100%; + height: 120rpx; + background: #fff; + } + + .confirm-btn { + width: 710rpx; + margin-left: 20rpx; + height: 80rpx; + background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); + border-radius: 40rpx; + color: #fff; + } + + // 优惠券按钮 + .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; + } + + .boder-btn { + background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light)); + color: #fff !important; + } + \ 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 648b32da..35ba9563 100644 --- a/sheep/components/s-coupon-list/s-coupon-list.vue +++ b/sheep/components/s-coupon-list/s-coupon-list.vue @@ -1,13 +1,9 @@