From b83b375945708b06c58dd928f30f31aa4d035cb4 Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Tue, 14 Jul 2020 10:13:27 +0800 Subject: [PATCH 1/2] retrieve file --- common/api/user.js | 4 ++++ components/mine/order-item/index.vue | 9 ++++++- pageC/cart/ConfirmOrder.vue | 11 +++++++-- pageC/cart/index.vue | 9 ++++++- pageE/mine/EditUserInfo.vue | 8 +++++-- pageE/mine/MineInfo.vue | 3 ++- pageE/order/Details.vue | 36 +++++++++++++++++++--------- pageE/order/Index.vue | 23 +++++++++++++----- pages/mine/index.vue | 3 ++- 9 files changed, 81 insertions(+), 25 deletions(-) diff --git a/common/api/user.js b/common/api/user.js index 2833b3b..d19df3f 100644 --- a/common/api/user.js +++ b/common/api/user.js @@ -236,6 +236,10 @@ export default { if(refund_state) Object.assign(params, {refund_state: refund_state}); return vm.$u.post('Order/orderList', params); }, + // 售后列表 + getAfterSaleList({ page }) { + return vm.$u.post('order/afterSaleList', { page: page }); + }, // 订单详情 getOrderInfo({ order_id }) { return vm.$u.post('Order/orderInfo', { order_id: order_id }); diff --git a/components/mine/order-item/index.vue b/components/mine/order-item/index.vue index eda2f40..16de16a 100644 --- a/components/mine/order-item/index.vue +++ b/components/mine/order-item/index.vue @@ -23,6 +23,7 @@ + 确认收货 查看物流 立即评价 取消支付 @@ -36,7 +37,7 @@ export default { data() { return { - state: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付 + state: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付, 7: 售后 } }, props: { @@ -69,6 +70,12 @@ export default { break; } if(this.order.refund_state) state = '已退款'; + // 申请退款 + if(this.order.refund_data) { + if([1, 2].indexOf(this.order.refund_data.refund_state) >= 0) state = '待退款'; + if(this.order.refund_data.refund_state == 3) state = '已退款'; + } + this.state = state; }, toOtherPage(url) { diff --git a/pageC/cart/ConfirmOrder.vue b/pageC/cart/ConfirmOrder.vue index 9c724d2..773de98 100644 --- a/pageC/cart/ConfirmOrder.vue +++ b/pageC/cart/ConfirmOrder.vue @@ -119,8 +119,15 @@ export default { this.getFreight(); }, methods: { - showTotalPrice() { - + sendOrder() { + this.$u.api.sendOrder({ + ifcart: 1, + // cart_id: , + address_id: this.addressInfo.area_id, + buy_city_id: this.addressInfo.city_id, + }).then(res => { + + }) }, getFreight() { this.$u.api.getFreight({ diff --git a/pageC/cart/index.vue b/pageC/cart/index.vue index f501e87..ac213ab 100644 --- a/pageC/cart/index.vue +++ b/pageC/cart/index.vue @@ -193,6 +193,14 @@ export default { }, onNavigationBarButtonTap(btn) { // console.log(btn); + // #ifdef H5 + this.status = '完成'; + if(this.status == '编辑'){ + this.status = "完成"; + }else{ + this.status = "编辑"; + } + // #endif if(btn.index == 0){ let pages = getCurrentPages(); let page = pages[pages.length - 1]; @@ -213,7 +221,6 @@ export default { }); this.status = titleObj.buttons[0].text; // #endif - } } }; diff --git a/pageE/mine/EditUserInfo.vue b/pageE/mine/EditUserInfo.vue index c5276bd..50e752b 100644 --- a/pageE/mine/EditUserInfo.vue +++ b/pageE/mine/EditUserInfo.vue @@ -61,6 +61,7 @@ export default { birthday: '', phoneNumber: '', avatar: '', + uploadPath: '', // 上传时的路径 } }, onLoad() { @@ -83,7 +84,10 @@ export default { name: 'avatar', filePath: res.tempFilePaths[0] }).then(result => { - this.avatar = result; + // console.log(result); + this.$set(this, 'avatar', result.file_path); + // this.avatar = result.file_path; + this.uploadPath = result.file_name; }, error => { this.$u.toast(error); }) @@ -108,7 +112,7 @@ export default { this.$u.api.updateMemberInfo({ nickname: this.nickname, gender: this.gender, - avatar: this.avatar, + avatar: this.uploadPath, birthday: this.birthday, }).then(res => { if (res.errCode == 0) { diff --git a/pageE/mine/MineInfo.vue b/pageE/mine/MineInfo.vue index a5ee6f0..120ae70 100644 --- a/pageE/mine/MineInfo.vue +++ b/pageE/mine/MineInfo.vue @@ -51,7 +51,8 @@ export default { getUserInfo() { this.$u.api.getMemberInfo().then(res => { if (res.errCode == 0) { - this.userInfo = res.data.MemberArray; + // this.userInfo = res.data.MemberArray; + this.$set(this, 'userInfo', res.data.MemberArray); } }) }, diff --git a/pageE/order/Details.vue b/pageE/order/Details.vue index 6b35b0e..c9e578a 100644 --- a/pageE/order/Details.vue +++ b/pageE/order/Details.vue @@ -12,10 +12,10 @@ - 山东省泰安市泰山区东岳大街与克山路交汇口银山店四楼橙天影视南邻山东省泰安市泰山区东岳大街与克山路交汇口银山店四楼橙天影视南邻 + {{ orderInfo.extend_order_common.reciver_info.address }} @@ -41,19 +41,19 @@ 运费(快递/骑手) - ¥0.00 + ¥{{ orderInfo.shipping_fee }} 店铺优惠 - ¥0.00 + ¥{{ orderInfo.extend_order_common.voucher_price || '0.00' }} 订单总价 - ¥{{ orderInfo.order_amount }} + ¥{{ orderInfo.goods_amount }} 实付费(含运费) - ¥{{ orderInfo.goods_amount }} + ¥{{ orderInfo.order_amount }} 支付方式 @@ -72,8 +72,8 @@ 立即评价 取消支付 立即支付 - 联系官方客服 - 提交官方审核 + 联系官方客服 + 提交官方审核 @@ -81,7 +81,7 @@ export default { data() { return { - state: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付 + state: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付 7: 待退款 8: 已退款 s_object: { '1': { text: '待收货', @@ -107,6 +107,14 @@ export default { text: '待支付', image: '../static/mine/31.png', }, + '7': { + text: '待退款', + image: '../static/mine/34.png', + }, + '8': { + text: '已退款', + image: '../static/mine/34.png', + }, }, current: 0, orderInfo: {} @@ -114,7 +122,7 @@ export default { }, onLoad(option) { this.setTitle(); - this.getOrderInfo(option.id); + this.getOrderInfo(option.oid); }, methods: { viewState(value) { @@ -139,6 +147,12 @@ export default { break; } if(this.orderInfo.refund_state) state = '5'; + // 申请退款 + const refund = this.orderInfo.refund_list[this.orderInfo.extend_order_common.order_id]; + if(this.orderInfo.refund_list) { + if([1, 2].indexOf(refund.refund_state) >= 0) state = '7'; + if(refund.refund_state == 3) state = '8'; + } this.state = state; }, getOrderInfo(id) { diff --git a/pageE/order/Index.vue b/pageE/order/Index.vue index a40c8a4..e46ca0a 100644 --- a/pageE/order/Index.vue +++ b/pageE/order/Index.vue @@ -53,7 +53,8 @@ export default { watch: { current(value) { this.page = 0; - this.getOrderList({ reload: 'again' }); + // again 重新请求列表 不然往列表里添加 + value == 6 ? this.getAfterSaleList({ reload: 'again' }): this.getOrderList({ reload: 'again' }); }, }, onLoad(option) { @@ -82,9 +83,6 @@ export default { case 5: type = 'state_noeval'; // 待评价 break; - case 6: - type = 40; // 售后 - break; default: type = -1; break; @@ -92,7 +90,17 @@ export default { const res = await this.$u.api.getOrderList({ page: this.page, type: type, - refund_state: this.current == 6 ? '1' : 0, // 判断是不是售后列表 + }) + this.timer = true; + if(res.errCode == 0) { + if(reload) this.orderList = res.data; + else this.orderList.push(...res.data); + } + return res; + }, + async getAfterSaleList({ reload = '' } = {}) { + const res = await this.$u.api.getAfterSaleList({ + page: this.page, }) this.timer = true; if(res.errCode == 0) { @@ -108,7 +116,10 @@ export default { this.timer = false; this.loadStatus.splice(this.current, 1, "loading"); this.page++; - this.getOrderList().then(res => { + let promise; + if(this.current == 6) promise = this.getAfterSaleList(); + else promise = this.getOrderList(); + promise.then(res => { this.loadStatus.splice(this.current, 1, "nomore"); if(res.data.length == 0) this.page--; }).catch(() => { diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 24780df..4561d67 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -145,7 +145,8 @@ export default { getUserInfo() { this.$u.api.getMemberInfo().then(res => { if (res.errCode == 0) { - this.userInfo = res.data.MemberArray; + // this.userInfo = res.data.MemberArray; + this.$set(this, 'userInfo', res.data.MemberArray); } }) }, From 4ab7d33643509718860743b0d140fd7b5ffb5022 Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Tue, 14 Jul 2020 17:43:15 +0800 Subject: [PATCH 2/2] 7.14 --- common/api/user.js | 14 ++ components/mine/order-item/index.vue | 11 +- pageC/cart/ConfirmOrder.vue | 41 ++++-- pageC/cart/cashier.vue | 188 +++++++++++++++++++++++++++ pageC/cart/index.vue | 13 +- pageE/more/WriteComments.vue | 12 +- pageE/order/Details.vue | 23 ++-- pageE/order/Index.vue | 8 +- pages.json | 14 +- static/image/common/13.png | Bin 0 -> 5045 bytes static/image/common/14.png | Bin 0 -> 5301 bytes 11 files changed, 299 insertions(+), 25 deletions(-) create mode 100644 pageC/cart/cashier.vue create mode 100644 static/image/common/13.png create mode 100644 static/image/common/14.png diff --git a/common/api/user.js b/common/api/user.js index d19df3f..302ecda 100644 --- a/common/api/user.js +++ b/common/api/user.js @@ -244,6 +244,20 @@ export default { getOrderInfo({ order_id }) { return vm.$u.post('Order/orderInfo', { order_id: order_id }); }, + // 取消订单 + cancelOrder({ order_id, msg = '' } = {}) { + let params = { order_id: order_id }; + if(msg) Object.assign(params, {msg: msg}); + return vm.$u.post('Order/buyer_cancel', params); + }, + // 删除订单 + deleteOrder({ order_id }) { + return vm.$u.post('order/order_delete', { order_id: order_id }); + }, + // 确认收货 + confirmReceive ({ order_id }) { + return vm.$u.post('Order/order_receive', { order_id: order_id }); + }, // 查询订单的评价信息 getOrderEvaluateInfo({ id }) { return vm.$u.post('Order/getOrderEvaluateInfo', { id: id }); diff --git a/components/mine/order-item/index.vue b/components/mine/order-item/index.vue index 16de16a..5fdd5e5 100644 --- a/components/mine/order-item/index.vue +++ b/components/mine/order-item/index.vue @@ -26,7 +26,7 @@ 确认收货 查看物流 立即评价 - 取消支付 + 取消支付 立即支付 联系官方客服 提交官方审核 @@ -78,6 +78,15 @@ export default { this.state = state; }, + cancelOrder() { + this.$u.api.cancelOrder({ + order_id: this.order.order_id, + }).then(res => { + if(res.errCode == 0) { + this.$emit("refreshOrderList", { reload: 'again' }); + } + }) + }, toOtherPage(url) { this.$u.route('/pageE/order/' + url, { oid: this.order.order_id, diff --git a/pageC/cart/ConfirmOrder.vue b/pageC/cart/ConfirmOrder.vue index 773de98..46bda90 100644 --- a/pageC/cart/ConfirmOrder.vue +++ b/pageC/cart/ConfirmOrder.vue @@ -26,7 +26,8 @@ {{ goods.goods_name }} ¥{{ goods.goods_price }} - + + ×{{ goods.goods_num }} @@ -73,7 +74,7 @@ 共件{{ orderInfo.store_cart_list | setTotalNumber }}商品 - 结算 + 结算 @@ -103,9 +104,10 @@ export default { let num = 0; for (const key in data) { if (data.hasOwnProperty(key)) { - const element = data[key][0]; - console.log(element); - num += element.goods_num; + const element = data[key]; + element.forEach(item => { + num += item.goods_num; + }) } } return num; @@ -115,18 +117,38 @@ export default { console.log(JSON.parse(option.info)); this.orderInfo = JSON.parse(option.info); this.addressInfo = this.orderInfo.address_info; - this.showTotalPrice(); this.getFreight(); }, methods: { sendOrder() { + // 拼接后端需要的数据形式 + let id = [], temp = ''; + const object = this.orderInfo.store_cart_list; + for (const key in object) { + if (object.hasOwnProperty(key)) { + const element = object[key]; + element.forEach(item => { + temp = item.cart_id + '|' + item.goods_num; + id.push(temp); + temp = ''; + }) + } + } this.$u.api.sendOrder({ ifcart: 1, - // cart_id: , - address_id: this.addressInfo.area_id, + cart_id: id, + address_id: this.addressInfo.address_id, buy_city_id: this.addressInfo.city_id, }).then(res => { - + if(res.errCode == 0) { + this.$u.route({ + url: '/pageC/cart/cashier', + params: { + pay_sn: res.data.pay_sn, + price: res.data.order_total_amount, + } + }) + } }) }, getFreight() { @@ -198,6 +220,7 @@ export default { .main { margin-bottom: 50rpx; > view { + margin-bottom: 20rpx; .goods-info { background-color: #ffffff; padding: 30rpx; diff --git a/pageC/cart/cashier.vue b/pageC/cart/cashier.vue new file mode 100644 index 0000000..facbe07 --- /dev/null +++ b/pageC/cart/cashier.vue @@ -0,0 +1,188 @@ + + + \ No newline at end of file diff --git a/pageC/cart/index.vue b/pageC/cart/index.vue index ac213ab..bc3c121 100644 --- a/pageC/cart/index.vue +++ b/pageC/cart/index.vue @@ -26,6 +26,9 @@ + + + @@ -85,6 +88,7 @@ export default { }, // 结算 settlementOrder() { + if(!this.checkedGoods.length) return false; // 拼接后端需要的数据形式 let id = [], temp = ''; this.checkedGoods.forEach(item => { @@ -194,7 +198,6 @@ export default { onNavigationBarButtonTap(btn) { // console.log(btn); // #ifdef H5 - this.status = '完成'; if(this.status == '编辑'){ this.status = "完成"; }else{ @@ -227,6 +230,8 @@ export default {