diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index 7f866a4c..9b4c8bf0 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -1,414 +1,388 @@ \ No newline at end of file + .cicon-box { + font-size: 36rpx; + color: #999999; + } + diff --git a/sheep/api/app.js b/sheep/api/app.js index 2bb92c6c..a174686d 100644 --- a/sheep/api/app.js +++ b/sheep/api/app.js @@ -115,12 +115,14 @@ export default { formData: { group, }, + // TODO 芋艿:临时写死 header: { // Accept: 'text/json', // Authorization: token, - Accept : '*/*', - 'tenant-id' :'1', - Authorization: 'Bearer test247', + Accept : '*/*', + 'tenant-id' :'1', + 'terminal': 20, + Authorization: 'Bearer test247', }, success: (uploadFileRes) => { let result = JSON.parse(uploadFileRes.data); diff --git a/sheep/api/order.js b/sheep/api/order.js index 8fb48cad..6dd8b362 100644 --- a/sheep/api/order.js +++ b/sheep/api/order.js @@ -65,27 +65,18 @@ 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 + ''; + if (data.items[i].cartId) { + data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + ''; + } } - console.log(data2, '对比数据') + const queryString= Object.keys(data2).map(key => key + '=' + data2[key]).join('&') return request2({ - url: 'trade/order/settlement', - method: 'GET', - // data, - params: data2 + url: `trade/order/settlement?${queryString}`, + method: 'GET' }) }, - // calc: (data) => - // request({ - // url: 'order/order/calc', - // method: 'POST', - // data, - // }), // 创建订单 create: (data) => request({ diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js index 9bdbb19e..feeb0caa 100644 --- a/sheep/api/promotion/coupon.js +++ b/sheep/api/promotion/coupon.js @@ -17,4 +17,17 @@ export default { params: { spuId, productScope, count }, }); }, + // 获得匹配指定商品的优惠劵列表 + getMatchCouponList: (price, spuIds, skuIds, categoryIds) => { + return request({ + url: '/app-api/promotion/coupon/match-list', + method: 'GET', + params: { + price, + spuIds: spuIds.join(','), + skuIds: skuIds.join(','), + categoryIds: categoryIds.join(','), + }, + }); + } }; diff --git a/sheep/api/trade/order.js b/sheep/api/trade/order.js new file mode 100644 index 00000000..10444657 --- /dev/null +++ b/sheep/api/trade/order.js @@ -0,0 +1,41 @@ +import request2 from '@/sheep/request2'; + +const OrderApi = { + // 计算订单信息 + settlementOrder: (data) => { + const data2 = { + ...data, + } + // 移除多余字段 + if (!(data.couponId > 0)) { + delete data2.couponId + } + if (!(data.addressId > 0)) { + delete data2.addressId + } + // 解决 SpringMVC 接受 List 参数的问题 + delete data2.items + for (let i = 0; i < data.items.length; i++) { + data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + ''; + data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + ''; + if (data.items[i].cartId) { + data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + ''; + } + } + const queryString= Object.keys(data2).map(key => key + '=' + data2[key]).join('&') + return request2({ + url: `trade/order/settlement?${queryString}`, + method: 'GET' + }) + }, + // 创建订单 + createOrder: (data) => { + return request2({ + url: `trade/order/create`, + method: 'POST', + data + }) + } +}; + +export default OrderApi; \ No newline at end of file diff --git a/sheep/components/s-coupon-select/s-coupon-select.vue b/sheep/components/s-coupon-select/s-coupon-select.vue index 928f903a..e1a9db43 100644 --- a/sheep/components/s-coupon-select/s-coupon-select.vue +++ b/sheep/components/s-coupon-select/s-coupon-select.vue @@ -1,3 +1,4 @@ +