增加退款

This commit is contained in:
TOP糯米 2023-03-18 13:32:03 +08:00
parent 7585368757
commit 4ebfc73eb3
4 changed files with 93 additions and 19 deletions

View File

@ -166,7 +166,14 @@ export default {
* 退款
*/
refundOrder() {
this.$utils.toPage("/pages/order/refund?id=" + this.order.worker.id);
let order = encodeURIComponent(
JSON.stringify({
id: this.order.id,
orderId: this.order.orderId,
price: this.order.price,
})
);
this.$utils.toPage("/pages/order/refund?list=" + this.order.listType + "&order=" + order);
},
/**
* 取消退款

View File

@ -224,6 +224,21 @@ export default {
url: ""
}
},
refund: {
t1: {
url: "/wxapp/order/backmoney",
showLoading: true,
auth: true,
},
t2: {
url: "/wxapp/orderb/backmoney",
showLoading: true,
auth: true,
},
t3: {
url: ""
},
},
chooseWorker: {
url: "/wxapp/orderb/chooseshifu",
showLoading: true,

View File

@ -274,5 +274,18 @@ export default {
return reject(response.msg);
}).catch(e => { });
});
},
/**
* 退款
*/
refundOrder(options) {
return new Promise((resolve, reject) => {
prototype.$request(options.request).then(response => {
if (response.code == 1) {
return resolve(response);
}
return reject(response.msg);
}).catch(e => { });
});
}
}

View File

@ -2,12 +2,12 @@
<app-layout :title="pageTitle">
<view class="order-id">
<text class="title">订单编号</text>
<text class="value">{{ orderId }}</text>
<text class="value">{{ order.orderId }}</text>
</view>
<view class="price">
<view class="title-box">申请退款</view>
<view class="price-box">
<text class="number">¥{{ utils.formatNumber(price, 2) }}</text>
<text class="number">¥{{ utils.formatNumber(order.price, 2) }}</text>
<view v-if="type == 'apply'" class="modify-icon" @click="postPriceModal = true">
<text class="iconfont icon-bianji"></text>
<text class="text">修改金额</text>
@ -44,8 +44,8 @@
</block>
<view class="upload-item">
<block v-for="(item, index) in images" :key="index">
<view class="image-box">
<image class="image" :src="item.src" mode="aspectFill" />
<view class="image-box" @click="removeImage(index)">
<image class="image" :src="item" mode="aspectFill" />
</view>
</block>
<view v-if="type == 'apply'" class="image-box upload" @click="chooseImage">
@ -55,7 +55,7 @@
</view>
</view>
<view v-if="type == 'apply'" class="common-save-form-btn">
<view class="btn" @click="save">提交</view>
<view class="btn" @click="submit">提交</view>
</view>
<widget-modal v-show="postPriceModal" title="修改退款金额" @close="postPriceModal = false">
<view class="price-box">
@ -64,15 +64,15 @@
<input
class="input"
type="number"
v-model="price"
v-model="order.price"
placeholder="请输入退款金额"
placeholder-class="placeholder-style-3"
/>
<text class="iconfont icon-qingchu" @click="price = 0"></text>
<text class="iconfont icon-qingchu" @click="order.price = 0"></text>
</view>
<text class="util"></text>
</view>
<view class="submit-price">
<view class="submit-price" @click="postPriceModal = false">
<text>确认</text>
</view>
</view>
@ -92,10 +92,9 @@ export default {
pageTitle: "申请退款",
postPriceModal: false,
maxlength: 200,
id: 1,
orderId: "xxgfdkgn1223",
price: 306,
content: "这个是申请内容",
listType: "",
order: {},
content: "",
images: [],
};
},
@ -104,6 +103,12 @@ export default {
WidgetModal,
},
onLoad(e) {
this.listType = e.list;
if (e.order && e.order.length > 0) {
this.order = JSON.parse(decodeURIComponent(e.order));
} else {
return this.$utils.toast("参数错误");
}
if (e.type && e.type == "reason") {
this.type = "reason";
this.pageTitle = "未通过原因";
@ -117,15 +122,49 @@ export default {
onReachBottom() {},
onPullDownRefresh() {},
methods: {
/**
* 删除图片
*/
removeImage(index) {
this.images.splice(index, 1);
},
/**
* 上传图片
*/
chooseImage() {
uni.chooseImage({
sizeType: ["compressed"],
sourceType: ["album"],
success(res) {
console.log(JSON.stringify(res.tempFilePaths));
},
this.$utils.chooseImage(9).then((tempFiles) => {
tempFiles.forEach((item) => {
this.$models.system.upload(item.path).then((response) => {
this.images.push(response.img);
});
});
});
},
/**
* 提交退款
*/
submit() {
this.$models.order
.refundOrder({
request: {
api: "order.refund." + this.listType,
data: {
id: this.order.id,
money: this.order.price,
img: this.images,
title: this.content,
},
},
})
.then((response) => {
this.$utils.toast(response.msg).then(() => {
this.$utils.toPage("", {}, "back");
});
})
.catch((e) => {
this.$utils.toast(e);
});
},
},
};
</script>