|
@@ -8,9 +8,12 @@
|
|
|
<view class="icon"><text class="iconfont icon-dingwei1"></text></view>
|
|
|
<view class="nodata" v-if="!addressInfo">选择联系人地址</view>
|
|
|
<view class="hasdata" v-else>
|
|
|
- <view class="name">{{ addressInfo.name }}<text>{{ addressInfo.phone }}</text></view>
|
|
|
+ <view class="name"
|
|
|
+ >{{ addressInfo.name }}<text>{{ addressInfo.phone }}</text></view
|
|
|
+ >
|
|
|
<view class="address ellipsis-2">
|
|
|
- {{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.area }}{{ addressInfo.street }}{{ addressInfo.address }}{{ addressInfo.houseNo }}
|
|
|
+ {{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.area }}{{ addressInfo.street
|
|
|
+ }}{{ addressInfo.address }}{{ addressInfo.houseNo }}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -115,8 +118,7 @@
|
|
|
<view class="it">
|
|
|
<block v-if="insideCodeImg">
|
|
|
<text class="iconfont icon-guanbi1 close" @tap="delImg('insideCodeImg')"></text>
|
|
|
- <image mode="aspectFill" :src="insideCodeImg" @tap="prevImg(insideCodeImg)">
|
|
|
- </image>
|
|
|
+ <image mode="aspectFill" :src="insideCodeImg" @tap="prevImg(insideCodeImg)"> </image>
|
|
|
</block>
|
|
|
<view class="empty" v-else @tap="chooseImg('insideCodeImg')">
|
|
|
<text class="iconfont icon-xiangji"></text>
|
|
@@ -128,8 +130,7 @@
|
|
|
<view class="it">
|
|
|
<block v-if="machineImg">
|
|
|
<text class="iconfont icon-guanbi1 close" @tap="delImg('machineImg')"></text>
|
|
|
- <image mode="aspectFill" :src="machineImg" @tap="prevImg(machineImg)">
|
|
|
- </image>
|
|
|
+ <image mode="aspectFill" :src="machineImg" @tap="prevImg(machineImg)"> </image>
|
|
|
</block>
|
|
|
<view class="empty" v-else @tap="chooseImg('machineImg')">
|
|
|
<text class="iconfont icon-xiangji"></text>
|
|
@@ -141,8 +142,7 @@
|
|
|
<view class="it">
|
|
|
<block v-if="buyCertImg">
|
|
|
<text class="iconfont icon-guanbi1 close" @tap="delImg('buyCertImg')"></text>
|
|
|
- <image mode="aspectFill" :src="buyCertImg" @tap="prevImg(buyCertImg)">
|
|
|
- </image>
|
|
|
+ <image mode="aspectFill" :src="buyCertImg" @tap="prevImg(buyCertImg)"> </image>
|
|
|
</block>
|
|
|
<view class="empty" v-else @tap="chooseImg('buyCertImg')">
|
|
|
<text class="iconfont icon-xiangji"></text>
|
|
@@ -161,31 +161,70 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
- <zjDialogPicker ref="brandDialog" :isShow="isShowBrandDialog" :multiple="false" :styleType="2" :title="'品牌'"
|
|
|
- :list="brandList" :keyName="'brandName'" @cancel="isShowBrandDialog = false" @confirm="confirmBrandDialog">
|
|
|
+ <zjDialogPicker
|
|
|
+ ref="brandDialog"
|
|
|
+ :isShow="isShowBrandDialog"
|
|
|
+ :multiple="false"
|
|
|
+ :styleType="2"
|
|
|
+ :title="'品牌'"
|
|
|
+ :list="brandList"
|
|
|
+ :keyName="'brandName'"
|
|
|
+ @cancel="isShowBrandDialog = false"
|
|
|
+ @confirm="confirmBrandDialog"
|
|
|
+ >
|
|
|
</zjDialogPicker>
|
|
|
- <zjDialogPicker ref="categoryDialog" :isShow="isShowCategoryDialog" :multiple="false" :styleType="2" :title="'产品大类'"
|
|
|
- :list="categoryList" :keyName="'name'" @cancel="isShowCategoryDialog = false" @confirm="confirmCategoryDialog">
|
|
|
+ <zjDialogPicker
|
|
|
+ ref="categoryDialog"
|
|
|
+ :isShow="isShowCategoryDialog"
|
|
|
+ :multiple="false"
|
|
|
+ :styleType="2"
|
|
|
+ :title="'产品大类'"
|
|
|
+ :list="categoryList"
|
|
|
+ :keyName="'name'"
|
|
|
+ @cancel="isShowCategoryDialog = false"
|
|
|
+ @confirm="confirmCategoryDialog"
|
|
|
+ >
|
|
|
</zjDialogPicker>
|
|
|
- <zjDialogPicker ref="serviceDialog" :isShow="isShowServiceDialog" :multiple="false" :styleType="2" :title="'服务内容'"
|
|
|
- :list="serviceList" :keyName="'content'" @cancel="isShowServiceDialog = false" @confirm="confirmServiceDialog">
|
|
|
+ <zjDialogPicker
|
|
|
+ ref="serviceDialog"
|
|
|
+ :isShow="isShowServiceDialog"
|
|
|
+ :multiple="false"
|
|
|
+ :styleType="2"
|
|
|
+ :title="'服务内容'"
|
|
|
+ :list="serviceList"
|
|
|
+ :keyName="'content'"
|
|
|
+ @cancel="isShowServiceDialog = false"
|
|
|
+ @confirm="confirmServiceDialog"
|
|
|
+ >
|
|
|
</zjDialogPicker>
|
|
|
- <zjDialogPicker ref="websitDialog" :isShow="isShowWebsitDialog" :multiple="false" :styleType="2" :title="'所属网点'"
|
|
|
- :list="websitList" :keyName="'name'" @cancel="isShowWebsitDialog = false" @confirm="confirmWebsitDialog">
|
|
|
+ <zjDialogPicker
|
|
|
+ ref="websitDialog"
|
|
|
+ :isShow="isShowWebsitDialog"
|
|
|
+ :multiple="false"
|
|
|
+ :styleType="2"
|
|
|
+ :title="'所属网点'"
|
|
|
+ :list="websitList"
|
|
|
+ :keyName="'name'"
|
|
|
+ @cancel="isShowWebsitDialog = false"
|
|
|
+ @confirm="confirmWebsitDialog"
|
|
|
+ >
|
|
|
</zjDialogPicker>
|
|
|
- <u-datetime-picker :show="isShowDatePicker" v-model="datePickerValue" mode="date" :formatter="formatter"
|
|
|
- @cancel="isShowDatePicker = false" @close="isShowDatePicker = false" @confirm="confirmDate"
|
|
|
- :minDate="minDate"></u-datetime-picker>
|
|
|
+ <u-datetime-picker
|
|
|
+ :show="isShowDatePicker"
|
|
|
+ v-model="datePickerValue"
|
|
|
+ mode="date"
|
|
|
+ :formatter="formatter"
|
|
|
+ @cancel="isShowDatePicker = false"
|
|
|
+ @close="isShowDatePicker = false"
|
|
|
+ @confirm="confirmDate"
|
|
|
+ :minDate="minDate"
|
|
|
+ ></u-datetime-picker>
|
|
|
<u-popup :show="isShowPay" mode="bottom">
|
|
|
<view class="pay">
|
|
|
<image class="close" @click="closePay()" src="/static/icon/close.png" mode="aspectFill"></image>
|
|
|
<view class="title">请支付</view>
|
|
|
- <view class="item">
|
|
|
- 服务类型: <text class="text">延保</text>
|
|
|
- </view>
|
|
|
- <view class="item">
|
|
|
- 使用类型: <text class="text">按使用年限</text>
|
|
|
- </view>
|
|
|
+ <view class="item"> 服务类型: <text class="text">延保</text> </view>
|
|
|
+ <view class="item"> 使用类型: <text class="text">按使用年限</text> </view>
|
|
|
<view class="item">
|
|
|
产品品牌: <text class="text">{{ brand ? brand.brandName : '' }}</text>
|
|
|
</view>
|
|
@@ -201,9 +240,9 @@
|
|
|
<view class="item">
|
|
|
服务金额: <text class="text">{{ service ? service.amount : '' }}</text>
|
|
|
</view>
|
|
|
- <view class="title" style="text-align: left;">选择支付方式</view>
|
|
|
+ <view class="title" style="text-align: left">选择支付方式</view>
|
|
|
<view class="payType">
|
|
|
- <view style="margin-bottom: 20rpx;">
|
|
|
+ <view style="margin-bottom: 20rpx">
|
|
|
<u-button type="primary" @click="scanCode" text="扫码支付 (推荐)"></u-button>
|
|
|
</view>
|
|
|
<u-button type="primary" @click="workerPay" :plain="true" text="代客支付"></u-button>
|
|
@@ -214,8 +253,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
|
|
|
-import { uploadImgFull, weixinPay, mini_env, wxScanCode } from '@/common/utils/util.js';
|
|
|
+import zjDialogPicker from '@/components/zj-dialog/zj-dialog-picker.vue'
|
|
|
+import { uploadImgFull, weixinPay, mini_env, wxScanCode } from '@/common/utils/util.js'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -258,14 +297,14 @@ export default {
|
|
|
onLoad() {
|
|
|
// 接收地址信息
|
|
|
this.crossPage.$on('chooseAddress', result => {
|
|
|
- this.addressInfo = result;
|
|
|
+ this.addressInfo = result
|
|
|
})
|
|
|
- this.getBrandList();
|
|
|
+ this.getBrandList()
|
|
|
},
|
|
|
|
|
|
onUnload() {
|
|
|
- this.crossPage.$off('chooseAddress');
|
|
|
- clearTimeout(this.timeout);
|
|
|
+ this.crossPage.$off('chooseAddress')
|
|
|
+ clearTimeout(this.timeout)
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
@@ -286,7 +325,7 @@ export default {
|
|
|
deadline() {
|
|
|
return function (time, num) {
|
|
|
let date = new Date(time)
|
|
|
- date.setFullYear(date.getFullYear() + num);
|
|
|
+ date.setFullYear(date.getFullYear() + num)
|
|
|
let y = date.getFullYear(),
|
|
|
m = date.getMonth() + 1,
|
|
|
d = date.getDate()
|
|
@@ -304,34 +343,42 @@ export default {
|
|
|
},
|
|
|
getBrandList() {
|
|
|
this.$api.post('/increConfig/getBrand').then(res => {
|
|
|
- this.brandList = res.data;
|
|
|
+ this.brandList = res.data
|
|
|
})
|
|
|
},
|
|
|
|
|
|
getCategoryList() {
|
|
|
- this.$api.post('/increConfig/getCategoryList', {
|
|
|
- brand: this.brand.brandName
|
|
|
- }).then(res => {
|
|
|
- this.categoryList = res.data;
|
|
|
- })
|
|
|
+ this.$api
|
|
|
+ .post('/increConfig/getCategoryList', {
|
|
|
+ brand: this.brand.brandName
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.categoryList = res.data
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
getServiceList() {
|
|
|
- if (!this.brand || !this.category) { return false }
|
|
|
- this.$api.post('/increConfig/getIncreItem', {
|
|
|
- brand: this.brand.brandName,
|
|
|
- mainName: this.category.name
|
|
|
- }).then(res => {
|
|
|
- this.serviceList = res.data;
|
|
|
- })
|
|
|
+ if (!this.brand || !this.category) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.$api
|
|
|
+ .post('/increConfig/getIncreItem', {
|
|
|
+ brand: this.brand.brandName,
|
|
|
+ mainName: this.category.name
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.serviceList = res.data
|
|
|
+ })
|
|
|
},
|
|
|
getWebsitList() {
|
|
|
- this.$api.get('/user/apply/websit', {
|
|
|
- isIncre: true,
|
|
|
- increId: this.service.increId
|
|
|
- }).then(res => {
|
|
|
- this.websitList = res.data;
|
|
|
- })
|
|
|
+ this.$api
|
|
|
+ .get('/user/apply/websit', {
|
|
|
+ isIncre: true,
|
|
|
+ increId: this.service.increId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.websitList = res.data
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
changeCategory() {
|
|
@@ -361,42 +408,42 @@ export default {
|
|
|
confirmBrandDialog(e) {
|
|
|
this.service = null
|
|
|
this.category = null
|
|
|
- this.brand = this.brandList[e[0]];
|
|
|
- this.isShowBrandDialog = false;
|
|
|
+ this.brand = this.brandList[e[0]]
|
|
|
+ this.isShowBrandDialog = false
|
|
|
this.getServiceList()
|
|
|
- this.getCategoryList();
|
|
|
+ this.getCategoryList()
|
|
|
},
|
|
|
|
|
|
confirmCategoryDialog(e) {
|
|
|
this.service = null
|
|
|
- this.category = this.categoryList[e[0]];
|
|
|
- this.isShowCategoryDialog = false;
|
|
|
+ this.category = this.categoryList[e[0]]
|
|
|
+ this.isShowCategoryDialog = false
|
|
|
this.getServiceList()
|
|
|
},
|
|
|
|
|
|
confirmServiceDialog(e) {
|
|
|
- this.service = this.serviceList[e[0]];
|
|
|
+ this.service = this.serviceList[e[0]]
|
|
|
this.increContent = this.serviceList[e[0]].content
|
|
|
- this.isShowServiceDialog = false;
|
|
|
+ this.isShowServiceDialog = false
|
|
|
this.date = this.insureTime ? this.deadline(`${y}-${m}-${d}`, this.service.limitNum) : ''
|
|
|
- this.getWebsitList();
|
|
|
+ this.getWebsitList()
|
|
|
},
|
|
|
|
|
|
confirmWebsitDialog(e) {
|
|
|
- this.websit = this.websitList[e[0]];
|
|
|
- this.isShowWebsitDialog = false;
|
|
|
+ this.websit = this.websitList[e[0]]
|
|
|
+ this.isShowWebsitDialog = false
|
|
|
},
|
|
|
|
|
|
confirmDate(e) {
|
|
|
- this.isShowDatePicker = false;
|
|
|
- let time = new Date(e.value);
|
|
|
- let y = time.getFullYear();
|
|
|
- let m = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
|
|
|
- let d = (time.getDate()) < 10 ? '0' + (time.getDate()) : time.getDate();
|
|
|
- let hh = (time.getHours()) < 10 ? '0' + (time.getHours()) : time.getHours();
|
|
|
- let mm = (time.getMinutes()) < 10 ? '0' + (time.getMinutes()) : time.getMinutes();
|
|
|
- let ss = (time.getSeconds()) < 10 ? '0' + (time.getSeconds()) : time.getSeconds();
|
|
|
- this.insureTime = `${y}-${m}-${d}`;
|
|
|
+ this.isShowDatePicker = false
|
|
|
+ let time = new Date(e.value)
|
|
|
+ let y = time.getFullYear()
|
|
|
+ let m = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1
|
|
|
+ let d = time.getDate() < 10 ? '0' + time.getDate() : time.getDate()
|
|
|
+ let hh = time.getHours() < 10 ? '0' + time.getHours() : time.getHours()
|
|
|
+ let mm = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()
|
|
|
+ let ss = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds()
|
|
|
+ this.insureTime = `${y}-${m}-${d}`
|
|
|
this.date = this.deadline(`${y}-${m}-${d}`, this.service.limitNum)
|
|
|
},
|
|
|
|
|
@@ -406,22 +453,22 @@ export default {
|
|
|
count: 1,
|
|
|
sizeType: ['compressed'],
|
|
|
sourceType: ['album', 'camera'],
|
|
|
- success: async (res) => {
|
|
|
- let data = await uploadImgFull(res.tempFilePaths[0]);
|
|
|
+ success: async res => {
|
|
|
+ let data = await uploadImgFull(res.tempFilePaths[0])
|
|
|
this[name] = data.url
|
|
|
},
|
|
|
- fail: (err) => {
|
|
|
- console.log(err);
|
|
|
- },
|
|
|
- });
|
|
|
+ fail: err => {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
// 预览图片
|
|
|
prevImg(url) {
|
|
|
uni.previewImage({
|
|
|
current: url,
|
|
|
- urls: [url],
|
|
|
- });
|
|
|
+ urls: [url]
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
delImg(name) {
|
|
@@ -454,136 +501,163 @@ export default {
|
|
|
} else if (!this.buyCertImg) {
|
|
|
return this.$toast('请上传购机凭证图片!')
|
|
|
} else {
|
|
|
- if (!this.is_confirm) { return this.$toast('请勿频繁点击!') }
|
|
|
+ if (!this.is_confirm) {
|
|
|
+ return this.$toast('请勿频繁点击!')
|
|
|
+ }
|
|
|
this.is_confirm = false
|
|
|
setTimeout(() => {
|
|
|
this.is_confirm = true
|
|
|
}, 3000)
|
|
|
- this.$api.postJson('/increConfig/buy', {
|
|
|
- increType: 1,
|
|
|
- pgIncreId: this.service.increId,
|
|
|
- pgIncreItemId: this.service.id,
|
|
|
- brandId: this.brand.id,
|
|
|
- brandName: this.brand.brandName,
|
|
|
- mainId: this.category.categoryId,
|
|
|
- mainName: this.category.name,
|
|
|
- increContent: this.service.content,
|
|
|
- limitNum: this.service.limitNum,
|
|
|
- amount: this.service.amount,
|
|
|
- websitId: this.websit.websitId,
|
|
|
- websitName: this.websit.name,
|
|
|
- insideCode: this.insideCode,
|
|
|
- invoiceAmount: this.invoiceAmount,
|
|
|
- insureTime: this.insureTime + ' 00:00:00',
|
|
|
- insideCodeImg: this.insideCodeImg,
|
|
|
- machineImg: this.machineImg,
|
|
|
- buyCertImg: this.buyCertImg,
|
|
|
- userName: this.addressInfo.name,
|
|
|
- userMobile: this.addressInfo.phone,
|
|
|
- userAddress: this.addressInfo.province + this.addressInfo.city + this.addressInfo.area + this.addressInfo.street + this.addressInfo.address + this.addressInfo.houseNo,
|
|
|
- userAddressId: this.addressInfo.userAddressId
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.orderId = res.data
|
|
|
- this.isShowPay = true
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$api
|
|
|
+ .postJson('/increConfig/buy', {
|
|
|
+ increType: 1,
|
|
|
+ pgIncreId: this.service.increId,
|
|
|
+ pgIncreItemId: this.service.id,
|
|
|
+ brandId: this.brand.id,
|
|
|
+ brandName: this.brand.brandName,
|
|
|
+ mainId: this.category.categoryId,
|
|
|
+ mainName: this.category.name,
|
|
|
+ increContent: this.service.content,
|
|
|
+ limitNum: this.service.limitNum,
|
|
|
+ amount: this.service.amount,
|
|
|
+ websitId: this.websit.websitId,
|
|
|
+ websitName: this.websit.name,
|
|
|
+ insideCode: this.insideCode,
|
|
|
+ invoiceAmount: this.invoiceAmount,
|
|
|
+ insureTime: this.insureTime + ' 00:00:00',
|
|
|
+ insideCodeImg: this.insideCodeImg,
|
|
|
+ machineImg: this.machineImg,
|
|
|
+ buyCertImg: this.buyCertImg,
|
|
|
+ userName: this.addressInfo.name,
|
|
|
+ userMobile: this.addressInfo.phone,
|
|
|
+ userAddress:
|
|
|
+ this.addressInfo.province +
|
|
|
+ this.addressInfo.city +
|
|
|
+ this.addressInfo.area +
|
|
|
+ this.addressInfo.street +
|
|
|
+ this.addressInfo.address +
|
|
|
+ this.addressInfo.houseNo,
|
|
|
+ userAddressId: this.addressInfo.userAddressId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.orderId = res.data
|
|
|
+ this.isShowPay = true
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 扫码
|
|
|
async scanCode() {
|
|
|
- if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`);
|
|
|
- var codeVal = await wxScanCode();
|
|
|
- this.userPay(codeVal);
|
|
|
+ if (this.canScanCode > 0) return this.$toast(`请等待${this.canScanCode}秒后重试`)
|
|
|
+ var codeVal = await wxScanCode()
|
|
|
+ this.userPay(codeVal)
|
|
|
},
|
|
|
|
|
|
async scanInsideCode() {
|
|
|
- var codeVal = await wxScanCode();
|
|
|
- this.insideCode = codeVal;
|
|
|
+ var codeVal = await wxScanCode()
|
|
|
+ this.insideCode = codeVal
|
|
|
},
|
|
|
|
|
|
// 用户支付
|
|
|
userPay(code) {
|
|
|
- this.$api.post('/increConfig/paid', {
|
|
|
- authCode: code,
|
|
|
- id: this.orderId,
|
|
|
- }).then((res) => {
|
|
|
- // 返回true,则支付成功
|
|
|
- if (res.data) {
|
|
|
- this.timeoutNum = 0;
|
|
|
- clearTimeout(this.timeout);
|
|
|
- this.$navToPage({
|
|
|
- url: `/packageHome/pages/addvalue/orderList`
|
|
|
- }, "reLaunch")
|
|
|
- }
|
|
|
- // 返回false,轮询3次
|
|
|
- else {
|
|
|
- if (this.timeoutNum < 4) {
|
|
|
- this.timeoutNum = this.timeoutNum + 1;
|
|
|
- this.timeout = setTimeout(() => {
|
|
|
- this.userPay(code);
|
|
|
- }, 1000);
|
|
|
- } else {
|
|
|
- this.timeoutNum = 0;
|
|
|
- clearTimeout(this.timeout);
|
|
|
- this.$navToPage({
|
|
|
- url: `/packageHome/pages/addvalue/orderList`
|
|
|
- }, "reLaunch")
|
|
|
+ this.$api
|
|
|
+ .post('/increConfig/paid', {
|
|
|
+ authCode: code,
|
|
|
+ id: this.orderId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ // 返回true,则支付成功
|
|
|
+ if (res.data) {
|
|
|
+ this.timeoutNum = 0
|
|
|
+ clearTimeout(this.timeout)
|
|
|
+ this.$navToPage(
|
|
|
+ {
|
|
|
+ url: `/packageHome/pages/addvalue/orderList`
|
|
|
+ },
|
|
|
+ 'reLaunch'
|
|
|
+ )
|
|
|
}
|
|
|
- }
|
|
|
- }).catch((res) => {
|
|
|
- this.timeoutNum = 0;
|
|
|
- clearTimeout(this.timeout);
|
|
|
- this.$tips(res.message);
|
|
|
- }).finally(() => {
|
|
|
- this.canScanCode = 15;
|
|
|
- let time = setInterval(() => {
|
|
|
- if (this.canScanCode > 0) {
|
|
|
- this.canScanCode = this.canScanCode - 1;
|
|
|
- } else {
|
|
|
- clearInterval(time);
|
|
|
+ // 返回false,轮询3次
|
|
|
+ else {
|
|
|
+ if (this.timeoutNum < 4) {
|
|
|
+ this.timeoutNum = this.timeoutNum + 1
|
|
|
+ this.timeout = setTimeout(() => {
|
|
|
+ this.userPay(code)
|
|
|
+ }, 1000)
|
|
|
+ } else {
|
|
|
+ this.timeoutNum = 0
|
|
|
+ clearTimeout(this.timeout)
|
|
|
+ this.$navToPage(
|
|
|
+ {
|
|
|
+ url: `/packageHome/pages/addvalue/orderList`
|
|
|
+ },
|
|
|
+ 'reLaunch'
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
- }, 1000);
|
|
|
- });
|
|
|
+ })
|
|
|
+ .catch(res => {
|
|
|
+ this.timeoutNum = 0
|
|
|
+ clearTimeout(this.timeout)
|
|
|
+ this.$tips(res.message)
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.canScanCode = 15
|
|
|
+ let time = setInterval(() => {
|
|
|
+ if (this.canScanCode > 0) {
|
|
|
+ this.canScanCode = this.canScanCode - 1
|
|
|
+ } else {
|
|
|
+ clearInterval(time)
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
//代客支付
|
|
|
workerPay() {
|
|
|
- mini_env((bool) => {
|
|
|
+ mini_env(bool => {
|
|
|
const that = this
|
|
|
- this.$api.post('/increConfig/pay', {
|
|
|
- id: this.orderId,
|
|
|
- ...(() => {
|
|
|
- if (bool) {
|
|
|
- return {
|
|
|
- miniPay: true,
|
|
|
- openId: this.$store.state.user.miniOpenId
|
|
|
+ this.$api
|
|
|
+ .post('/increConfig/pay', {
|
|
|
+ id: this.orderId,
|
|
|
+ ...(() => {
|
|
|
+ if (bool) {
|
|
|
+ return {
|
|
|
+ miniPay: true,
|
|
|
+ openId: this.$store.state.user.miniOpenId
|
|
|
+ }
|
|
|
}
|
|
|
+ return {}
|
|
|
+ })()
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (!res.data) return false
|
|
|
+ if (bool) {
|
|
|
+ uniWebview.navigateTo({
|
|
|
+ url: `/pages/pay/pay?${Object.entries({
|
|
|
+ ...res.data,
|
|
|
+ payPackage: res.data.payPackage.split('=')[0] || '',
|
|
|
+ payPackageVal: res.data.payPackage.split('=')[1] || ''
|
|
|
+ })
|
|
|
+ .map(item => item.join('='))
|
|
|
+ .join('&')}`
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ weixinPay(res.data, function (res) {
|
|
|
+ that.$successToast('支付成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ that.$navToPage(
|
|
|
+ {
|
|
|
+ url: `/packageHome/pages/addvalue/orderList`
|
|
|
+ },
|
|
|
+ 'reLaunch'
|
|
|
+ )
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
}
|
|
|
- return {}
|
|
|
- })()
|
|
|
- }).then((res) => {
|
|
|
- if (!res.data) return false;
|
|
|
- if (bool) {
|
|
|
- uniWebview.navigateTo({
|
|
|
- url: `/pages/pay/pay?${Object.entries({
|
|
|
- ...res.data,
|
|
|
- payPackage: res.data.payPackage.split("=")[0] || "",
|
|
|
- payPackageVal: res.data.payPackage.split("=")[1] || ""
|
|
|
- }).map(item => item.join("=")).join("&")}`
|
|
|
- })
|
|
|
- } else {
|
|
|
- weixinPay(res.data, function (res) {
|
|
|
- that.$successToast('支付成功');
|
|
|
- setTimeout(() => {
|
|
|
- that.$navToPage({
|
|
|
- url: `/packageHome/pages/addvalue/orderList`
|
|
|
- }, "reLaunch")
|
|
|
- }, 1000)
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -595,7 +669,7 @@ export default {
|
|
|
url: `/packageHome/pages/addvalue/explainList`
|
|
|
})
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|