This commit is contained in:
luyuan 2020-08-17 12:11:38 +08:00
parent 5a2fc6e94c
commit fb297a74ce
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
4 changed files with 166 additions and 104 deletions

View File

@ -359,6 +359,10 @@ export default {
isNewmembervoucher() {
return vm.$u.post('Coupon/isNewmembervoucher')
},
//待发货退款
addrefundall() {
return vm.$u.post('order/add_refund_all')
},
}
}

View File

@ -24,7 +24,7 @@
</view>
<view class="order-btn" v-if="[1, 2, 3, 4, 8, 11].indexOf(order.view_type) >= 0">
<!-- || order.view_type == 2 -->
<view class="cancel" v-if="(order.view_type == 3) && order.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
<view class="cancel" v-if="(order.view_type == 3 || order.view_type == 2) && order.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
<view class="cancel" v-if="order.view_type == 3 && order.shipping_code" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="order.view_type == 3" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="order.view_type == 4" @click="toOtherPage('Comment')">立即评价</view>
@ -46,14 +46,13 @@ import common from '@/static/js/common.js';
export default {
data() {
return {
state: '',
}
},
props: {
order: Object
},
mounted() {
this.viewState();
// this.viewState();
},
filters: {
concatSpec(value) {
@ -68,7 +67,48 @@ export default {
}
},
methods: {
viewState() {
cancelOrder() {
this.$u.api.cancelOrder({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
},
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
},
toOtherPage(url) {
this.$u.route('/pageE/order/' + url, {
oid: this.order.order_id,
type:this.order.view_type
});
},
payNow(pay_sn, order_amount, id) {
this.$u.route('/pageC/cart/cashier', {
pay_sn: pay_sn,
price: order_amount,
order_id: id
});
},
makePhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
}
},
computed:{
state() {
let state;
// console.log(this.order.view_type);
switch (this.order.view_type) {
@ -106,46 +146,9 @@ export default {
break;
}
// console.log(state);
this.state = state;
return state;
},
cancelOrder() {
this.$u.api.cancelOrder({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
},
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
},
toOtherPage(url) {
this.$u.route('/pageE/order/' + url, {
oid: this.order.order_id,
});
},
payNow(pay_sn, order_amount, id) {
this.$u.route('/pageC/cart/cashier', {
pay_sn: pay_sn,
price: order_amount,
order_id: id
});
},
makePhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
}
},
}
};
</script>
<style lang="scss" scoped>

View File

@ -91,7 +91,6 @@
export default {
data() {
return {
orderstate: '',
s_object: {
'1': {
text: '待收货',
@ -154,44 +153,7 @@ export default {
clearInterval(this.timer);
},
methods: {
viewState(value) {
let state;
switch (value) {
case 1:
state = '6';
break;
case 2:
state = '4';
break;
case 3:
state = '1';
break;
case 4:
state = '2';
break;
case 5:
state = '3';
break;
case 6:
state = '7';
break;
case 7:
state = '5';
break;
case 9:
state = '8';
break;
case 10:
state = '9';
break;
case 11:
state = '10';
break;
default:
break;
}
this.orderstate = state;
},
viewStoreDetails(id) {
this.$u.route('pageC/merchant/index', {
id: id
@ -239,9 +201,9 @@ export default {
this.$u.api.getOrderInfo({
order_id: id,
}).then(res => {
console.log(res)
if(res.errCode == 0) {
this.orderInfo = res.data;
this.viewState(this.orderInfo.view_type);
this.setTitle(this.orderInfo.view_type);
if(res.data.view_type == 1) this.setSpikeTime(res.data.end_time);
else if(res.data.view_type == 9) this.setSpikeTime(res.data.pintuangroup_endtime);
@ -260,9 +222,10 @@ export default {
},
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
order_id: this.orderInfo.order_id,
}).then(res => {
if(res.errCode == 0) {
console.log(res,"确认支付")
this.getOrderInfo(this.oid);
}
this.$u.toast(res.message);
@ -300,6 +263,46 @@ export default {
});
}
},
computed:{
orderstate() {
let state;
switch (this.orderInfo.view_type) {
case 1:
state = '6';
break;
case 2:
state = '4';
break;
case 3:
state = '1';
break;
case 4:
state = '2';
break;
case 5:
state = '3';
break;
case 6:
state = '7';
break;
case 7:
state = '5';
break;
case 9:
state = '8';
break;
case 10:
state = '9';
break;
case 11:
state = '10';
break;
default:
break;
}
return state;
},
}
};
</script>
<style lang="scss" scoped>

View File

@ -1,7 +1,27 @@
<template>
<view class="refund">
<view class="radios-container">
<u-radio-group v-model="value" @change="radioChange">
<view v-if="type == 2">
<label class="radio-view" v-for="(item, index) in goodsList" :key="index">
<view class="store_info">
<view class="info_img">
<image :src="item.goods_image" mode="">
</view>
<view class="info_txt">
<view class="content u-line-2">
{{ item.goods_name }}
</view>
<view class="much">
<text>{{ item.goods_price }}</text>
<text>x{{ item.goods_num }}</text>
</view>
</view>
</view>
</label>
</view>
<u-radio-group v-model="value" @change="radioChange" v-else>
<label class="radio-view" v-for="(item, index) in goodsList" :key="index">
<view class="radio">
<u-radio color="#F0AD4E" :name="item.goods_id" active-color="#FF780F" icon-size="24" shape="circle"></u-radio>
@ -15,7 +35,7 @@
{{ item.goods_name }}
</view>
<view class="much">
<text>{{ item.goods_pay_price }}</text>
<text>{{ item.goods_price }}</text>
<text>x{{ item.goods_num }}</text>
</view>
</view>
@ -24,9 +44,9 @@
</u-radio-group>
</view>
<view class="refund-details">
<view class="goods-number">
<view class="goods-number" v-if="type != 2">
<view>选择数量</view>
<u-number-box :input-width="40" :input-height="38" :size="22" bg-color="#FFFFFF" :disabled-input=true color="#FF780F" :max="goods.goods_num" v-model="num"></u-number-box>
<u-number-box :input-width="40" :input-height="38" :size="22" bg-color="#FFFFFF" :disabled-input=true color="#FF780F" :max="goods.goods_num" v-model="num" :disabled="type == 2"></u-number-box>
</view>
<view class="refund-price">
<view class="price">
@ -57,14 +77,26 @@ export default {
value: '',
refundText: '',
num: 0,
type:0,
sel:true
}
},
computed: {
totalPrice() {
return (this.goods.goods_pay_price * this.num).toFixed(2);
if(this.type == 2){
console.log(this.goodsList)
let pac = 0;
for(let i in this.goodsList){
pac += parseFloat(this.goodsList[i].goods_pay_price) * 100 ;
}
return pac / 100;
}else{
return this.goods.goods_pay_price;
}
}
},
onLoad(option) {
this.type = option.type
this.oid = option.oid;
this.getOrderInfo(option.oid);
},
@ -76,7 +108,7 @@ export default {
// console.log(goodsList);
this.goods = goodsList[0];
this.num = this.goods.goods_num;
// console.log(this.goods);
console.log(this.goods);
},
getOrderInfo(id) {
this.$u.api.getOrderInfo({
@ -106,7 +138,8 @@ export default {
return true;
},
applyRefund() {
if(!this.verifyParams()) return false;
if(this.type !=2 && !this.verifyParams()) return false;
let params = {
order_id: this.oid,
goods_id: this.goods.goods_id,
@ -114,19 +147,38 @@ export default {
reason_info: this.refundText,
goods_num: this.num,
}
this.$u.api.refundOrder(params).then(res => {
if(res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
back: true,
})
} else {
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}
})
console.log(params)
if(this.type == 2){
this.$u.api.addrefundall(params).then(res => {
console.log(JSON.stringify(res))
if(res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
back: true,
})
} else {
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}
})
}else{
this.$u.api.refundOrder(params).then(res => {
if(res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
back: true,
})
} else {
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}
})
}
},
}
};