diff --git a/components/dialogOrderAfterSale.vue b/components/dialogOrderAfterSale.vue index 5e978d6..ddee778 100644 --- a/components/dialogOrderAfterSale.vue +++ b/components/dialogOrderAfterSale.vue @@ -25,7 +25,8 @@ 没收到货,或与卖家写上同意无需要退货只退款 -
  • + +
  • 退货退款 @@ -224,7 +225,15 @@ export default { .then((res) => { if (res.code == 0) { this.orderData = res.data - this.orderGoodsList = res.data.order_goods//需要售后的商品列表 + + let _refund_goods_data = [];//允许退款的商品 + res.data.order_goods.forEach((v)=>{ + if(v.refund_status == 0){ + _refund_goods_data.push(v) + } + }) + this.orderGoodsList = _refund_goods_data//需要售后的商品列表 + console.log('1111',this.orderGoodsList) }else{ this.$message.error(res.message); diff --git a/pages/order/index.vue b/pages/order/index.vue index 63224cb..9aef6ed 100644 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -183,7 +183,7 @@ diff --git a/pages/order/processRefunds.vue b/pages/order/processRefunds.vue index 0297fea..15ce5eb 100644 --- a/pages/order/processRefunds.vue +++ b/pages/order/processRefunds.vue @@ -46,7 +46,8 @@

    退款成功

    退款总金额: - ¥{{refundData.real_goods_money}} + + ¥{{orderGoodsData.refund_status == 3 ? orderGoodsData.refund_real_money : orderGoodsData.refund_apply_money}}

    @@ -74,13 +75,22 @@
    申请时间
    {{ $dayjs(refundData.refund_action_time*1000).format('YYYY-MM-DD HH:mm:ss') }}
    -
    + + +
    退款金额
    -
    ¥{{refundData.refund_fee}}
    +
    ¥{{refundData.refund_real_money}}
    + + +
    +
    退款金额
    +
    ¥{{refundData.refund_apply_money}}
    +
    +
    退款原因
    -
    {{refundData.refund_reason}}
    +
    {{orderGoodsData.refund_remark}}
    + + + + + + 填写快递运单号
    @@ -50,19 +58,16 @@ > @@ -117,9 +122,15 @@ export default { // 运单号弹出框 isWaybill: false, waybillDialog: false, + + order_goods_ids:[], + order_goods_data:'',//需要售后的商品订单表信息 + refundData: {},//要退款的商品数据 + //卖家退货运单需要填写的表单 waybillForm: { - region: "", - name: "" + refund_delivery_name: "",//物流公司 + refund_delivery_no: "",//物流单号 + refund_delivery_remark: "",//物流说明 }, orderData: {}, @@ -137,18 +148,20 @@ export default { this.iSrefund = undefined; this.iSfailed = undefined; this.stepActive = 0; + + this.order_goods_data = this.$route.query.row;//需要售后的商品订单表信息 if (this.$route.query.row.refund_status == 0) { this.orderData = this.$route.query.row; } else { let status = this.$route.query.row.refund_status; this.getRefundOrder(this.$route.query.row.order_id, status); - console.log( - this.stepActive, - this.iSfailed, - this.iSrefund, - status, - 111111 - ); + // console.log( + // this.stepActive, + // this.iSfailed, + // this.iSrefund, + // status, + // 111111 + // ); } }, mounted() { @@ -166,6 +179,12 @@ export default { console.log(status, `status`); console.log(this.orderData, `this.orderData`); + this.order_goods_ids = this.orderData.order_goods.map(item => { + return item.order_goods_id; + }); + + this.getRefundData() + // refund_status 1申请退款 2已确认 3已完成 4等待买家发货 5等待卖家发货 6卖家确认收货 -1卖家拒绝退款 -2卖家关闭退款 switch (status) { case -1: @@ -186,9 +205,18 @@ export default { this.stepActive = 3; this.iSrefund = true; break; - // case 4: - // this.stepActive = 2; - // break; + case 4://4等待买家发货 + this.stepActive = 2; + this.iSfailed = true; + break; + case 5://5等待卖家发货 + this.stepActive = 2; + this.iSfailed = false; + break; + case 6://6卖家确认收货 + this.stepActive = 2; + this.iSfailed = false; + break; // default: // this.stepActive = 0; @@ -251,22 +279,67 @@ export default { showWaybill() { this.waybillDialog = true; }, - // 运单号弹出框确认按钮 + + //获取要退货的商品信息 + getRefundData() { + // 多个退款数据查询 + // if (this.orderData.order_goods.length > 1) { + let obj = { + order_goods_id: this.order_goods_ids.toString() + }; + this.$axios + .post(`/orderrefund/detail`, obj) + .then(res => { + this.refundData = res.data; + //console.log('qq3',res.data); + }) + .catch(err => { + this.$message.error(err); + }); + }, + + // 运单号弹出框确认按钮点击事件 clickConfirm() { let obj = { - order_goods_id: "", - refund_delivery_name: "", - refund_delivery_no: "" - // refund_delivery_remark + order_goods_id: this.$route.query.row.order_goods_id, + refund_delivery_name: this.waybillForm.refund_delivery_name, + refund_delivery_no: this.waybillForm.refund_delivery_no, + refund_delivery_remark:this.waybillForm.refund_delivery_remark, }; + //验证必填参数 + if (!obj.refund_delivery_name){ + this.$message.error("请填写物流公司名称"); + return; + } + if (!obj.refund_delivery_no){ + this.$message.error("请填写物流单号"); + return; + } + //发送请求 + this.$axios + .post(`/orderrefund/delivery`, obj) + .then(res => { + console.log('qq2',res) + if(res.code == 0){ + this.$message.success(res.message); + }else{ + this.$message.error(res.message); + } + }) + .catch(err => { + this.$message.error(err); + }); + + this.waybillDialog = false; - // if (this.stepActive++ > 2) this.stepActive = 0; + }, + //撤销退款申请 cancelRefund() { console.log(); let obj = { - order_goods_id: this.$refs.processRefunds.order_goods_ids.toString() + order_goods_id: this.$route.query.row.order_goods_id.toString() }; this.$axios .post(`/orderrefund/cancel`, obj) @@ -362,4 +435,4 @@ export default { } } } - \ No newline at end of file + diff --git a/pages/shopping_cart/submit_order.vue b/pages/shopping_cart/submit_order.vue index 729231f..40effe1 100644 --- a/pages/shopping_cart/submit_order.vue +++ b/pages/shopping_cart/submit_order.vue @@ -548,9 +548,24 @@ export default { is_invoice: this.paymentForm.is_invoice ? 1 : 0, //是否需要开发票 store_id: JSON.parse(localStorage.getItem("drugstoreObj")).id, }; - this.$axios.post(`/ordercreate/create`, obj).then((res) => { - this.orderNum = res.data; - }); + // this.$axios.post(`/ordercreate/create`, obj).then((res) => { + // this.orderNum = res.data; + // }); + + this.$axios + .post(`/ordercreate/create`, obj) + .then(res => { + if(res.code != 0){ + this.$message.error(res.message); + } + this.orderNum = res.data; + }) + .catch(err => { + this.$message.error(err); + }); + + + this.paymentDialog = true; }, // 提交订单弹出框取消按钮