dingdong-master/pages/order-manage/modal/new-serv-price-offline.vue

185 lines
6.3 KiB
Vue
Raw Normal View History

2022-09-25 00:22:59 +08:00
<template>
<!-- 报价/客户支付模态框 -->
<view class="cu-modal" :class="show?'show':''">
<view class="cu-dialog">
<view class="cu-bar bg-white justify-end solid-bottom">
<view class="content">到付款单/二维码支付</view>
<view class="action" data-modal="showNewServPriceOfflineModal" @click="hideModal">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding padding-lr-xl bg-white text-left">
<view class="text-lg">上门后新增的报价</view>
<radio-group class="padding-tb-sm">
<view class="padding-tb-sm" @click="changePayAction(0)">
<radio style="transform:scale(0.7)" class="main-color" :checked="payAction === 0"></radio>
<text class="margin-left">无报价直接拍照完单</text>
</view>
<view class="padding-tb-sm flex justify-start align-start" @click="changePayAction(1)">
<radio style="transform:scale(0.7)" class="main-color" :checked="payAction === 1"></radio>
<view class="margin-left">
<view>上门有加单请客户支付</view>
<view class="flex justify-start margin-top-sm align-center">
<text>加单总额</text>
<input class="radius-input inline-input" type="digit" v-model="newPriceForA1"></input>
2022-09-25 00:22:59 +08:00
<text class="margin-left-xs"></text>
2022-10-21 00:37:07 +08:00
<view class="cu-btn line-main-color sm margin-left" v-if="priceObj && priceObj.type == 1"
2022-09-25 00:22:59 +08:00
@click="changeOrderPrice(newPriceForA1)">修改报价</view>
<view class="cu-btn line-main-color sm margin-left" v-else
@click="changeOrderPrice(newPriceForA1)">确认报价</view>
</view>
</view>
</view>
<view class="padding-tb-sm flex justify-start align-start" @click="changePayAction(2)">
<radio style="transform:scale(0.7)" class="main-color" :checked="payAction === 2"></radio>
<view class="margin-left">
<view>上门报价类给现场客户的报价</view>
<view class="flex justify-start margin-top-sm align-center">
<text>报价总额</text>
<input class="radius-input inline-input" type="digit" v-model="newPriceForA2"></input>
2022-09-25 00:22:59 +08:00
<text class="margin-left-xs"></text>
2022-10-21 00:37:07 +08:00
<view class="cu-btn line-main-color sm margin-left" v-if="priceObj && priceObj.type == 2"
2022-09-25 00:22:59 +08:00
@click="changeOrderPrice(newPriceForA2)">修改报价</view>
<view class="cu-btn line-main-color sm margin-left" v-else
@click="changeOrderPrice(newPriceForA2)">确认报价</view>
</view>
</view>
</view>
</radio-group>
<view class="margin-top-sm">
<textarea style="width: 100%; height: 200rpx;" class="solid radius text-left padding-sm"
v-model="remark" maxlength="-1"
placeholder="报价额需符合双方约定并把关键内容附上。如保内维修XX含配件XXX等分别XX元。如约定下单方寄配件则订单内“申请配件发起”。"></textarea>
</view>
</view>
<view class="cu-bar bg-white solid-top">
<view class="action margin-0 flex-sub text-black" data-modal="showNewServPriceOfflineModal"
@click="hideModal">退出/再次上门</view>
2022-10-15 01:44:49 +08:00
<view class="action margin-0 flex-sub text-main-color solid-left" v-if="(priceObj && priceObj.payStatus === 0) || data.payStatus === 0"
2022-09-25 00:22:59 +08:00
data-modal="showPayQrcodeModal" @tap="makePayQrcode($event)">请客户支付</view>
<view class="action margin-0 flex-sub text-main-color solid-left"
data-modal="showNewServPriceOfflineModal" @tap="hideModal" @click="goFinishOrder" v-else>去完单</view>
</view>
</view>
<pay-qrcode ref="payQrcode" :show="showPayQrcodeModal" :data="data" @finishQrPay="finishQrPay"></pay-qrcode>
</view>
</template>
2022-05-09 10:00:16 +08:00
<script>
2022-09-25 00:22:59 +08:00
import payQrcode from '@/pages/order-manage/modal/pay-qrcode.vue';
export default {
2022-05-09 10:00:16 +08:00
nama: 'new-serv-price',
2022-09-25 00:22:59 +08:00
components: {
payQrcode
},
props: {
show: {
type: Boolean,
default: false
},
data: {
type: Object,
default: {}
}
},
data() {
2022-05-09 10:00:16 +08:00
return {
2022-09-25 00:22:59 +08:00
priceObj: null,
payAction: 0,
newPriceForA2: null,
newPriceForA1: null,
newPrice: null,
2022-09-26 02:30:57 +08:00
showPayQrcodeModal: false,
remark: ""
2022-09-25 00:22:59 +08:00
}
},
2022-05-09 10:00:16 +08:00
methods: {
2022-09-25 00:22:59 +08:00
init(priceObj) {
2022-10-21 00:37:07 +08:00
if (!priceObj || priceObj.payStatus == 1) {
return;
}
2022-09-25 00:22:59 +08:00
this.priceObj = priceObj;
if (priceObj && priceObj.type) {
2022-09-26 02:30:57 +08:00
this.remark = priceObj.remark;
2022-09-25 00:22:59 +08:00
this.payAction = priceObj.type;
let money = priceObj.changeMoney;
if (this.payAction === 1) {
this.newPriceForA1 = money;
} else if (this.payAction === 2) {
this.newPriceForA2 = money;
}
}
},
resetData() {
this.payAction = 0;
this.newPrice = null;
this.newPriceForA2 = null;
this.newPriceForA1 = null;
this.priceObj = null;
2022-09-26 02:30:57 +08:00
this.remark = "";
2022-09-25 00:22:59 +08:00
},
2022-05-09 10:00:16 +08:00
hideModal(e) {
2022-09-25 00:22:59 +08:00
this.resetData();
uni.$emit(this.$globalFun.HIDE_MODAL, e);
},
async resetPriceChangedInfo() {
let res = await this.$request.getChangeOrderPrice(this.data);
if (res && res.code === 0) {
this.resetData();
this.init(res.data);
}
2022-05-09 10:00:16 +08:00
},
2022-09-25 00:22:59 +08:00
changePayAction(payAction) {
this.payAction = payAction;
},
2022-10-21 00:37:07 +08:00
async changeOrderPrice(newPrice) {
if (this.priceObj && this.payAction != this.priceObj.type) {
2022-10-21 00:37:07 +08:00
uni.showToast({
icon: 'none',
title: '你有加价未付款,请客户支付后再加或在原加价上增加金额!',
duration: 3500
})
return;
}
2022-09-25 00:22:59 +08:00
let res = await this.$request.changeOrderPrice({
orderDetailId: this.data.orderDetailId,
changeMoney: newPrice,
2022-09-26 02:30:57 +08:00
type: this.payAction,
remark: this.remark
2022-09-25 00:22:59 +08:00
});
if (res && res.code === 0) {
uni.showToast({
icon: 'success',
title: '修改成功'
})
setTimeout(() => {
this.resetPriceChangedInfo();
}, 1500);
2022-09-25 00:22:59 +08:00
}
},
async makePayQrcode(e) {
2022-09-26 02:30:57 +08:00
let res = await this.$request.priceAddedQrPay(this.data);
2022-09-25 00:22:59 +08:00
if (res && res.code === 0) {
this.showPayQrcodeModal = true;
this.$refs.payQrcode.showQrcode(res.data.expend.qrcode_url);
}
},
finishQrPay(e) {
this.showPayQrcodeModal = false;
this.resetPriceChangedInfo();
2022-05-09 10:00:16 +08:00
},
2022-09-25 00:22:59 +08:00
goFinishOrder() {
this.$emit('finishOrder', this.data);
}
}
}
</script>
<style scoped>
.inline-input {
flex-basis: 30%;
2022-09-25 00:22:59 +08:00
}
2022-05-09 10:00:16 +08:00
</style>