|
@@ -17,12 +17,55 @@
|
|
<div class="tj" v-if="item.isFirst == 1">推荐</div>
|
|
<div class="tj" v-if="item.isFirst == 1">推荐</div>
|
|
<div class="year">{{ item.normName }}</div>
|
|
<div class="year">{{ item.normName }}</div>
|
|
<div class="new">
|
|
<div class="new">
|
|
- <span style="font-size: 20px">¥</span>{{ (item.normAmount * 100 - item.discountAmount * 100) / 100 }}
|
|
|
|
|
|
+ <template v-if="item.id != '000'">
|
|
|
|
+ <span style="font-size: 20px">¥</span>{{ (item.normAmount * 100 - item.discountAmount * 100) / 100 }}
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <span style="font-size: 20px">¥</span
|
|
|
|
+ >{{
|
|
|
|
+ serviceProductList
|
|
|
|
+ .filter(item => !!~formgengduode.serviceProductList.indexOf(item.dictCode))
|
|
|
|
+ .map(item => item.price)
|
|
|
|
+ .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * formgengduode.year
|
|
|
|
+ }}
|
|
|
|
+ </template>
|
|
</div>
|
|
</div>
|
|
- <div class="old">¥{{ item.normAmount }}</div>
|
|
|
|
|
|
+ <div v-if="item.id != '000'" class="old">¥{{ item.normAmount }}</div>
|
|
<div :class="goodsIndex == index ? 'bottom active' : 'bottom'">立省¥{{ item.discountAmount }}</div>
|
|
<div :class="goodsIndex == index ? 'bottom active' : 'bottom'">立省¥{{ item.discountAmount }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div v-if="goodsId == '000'" style="margin: 20px 0">
|
|
|
|
+ <el-form ref="form" :model="formgengduode" label-width="160px">
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="选择需要购买模块"
|
|
|
|
+ style="text-align: left"
|
|
|
|
+ prop="serviceProductList"
|
|
|
|
+ :rules="[{ required: true, message: '请选择', trigger: 'blur' }]"
|
|
|
|
+ >
|
|
|
|
+ <el-checkbox-group v-model="formgengduode.serviceProductList">
|
|
|
|
+ <el-checkbox v-for="(item, index) in serviceProductList" :key="index" :label="item.dictCode" name="type"
|
|
|
|
+ >{{ item.dictValue }}(¥{{ item.price }})</el-checkbox
|
|
|
|
+ >
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="选择需要购买年限"
|
|
|
|
+ style="text-align: left"
|
|
|
|
+ prop="year"
|
|
|
|
+ :rules="[{ required: true, message: '请选择', trigger: 'blur' }]"
|
|
|
|
+ >
|
|
|
|
+ <el-input-number
|
|
|
|
+ size="mini"
|
|
|
|
+ style="width: 200px"
|
|
|
|
+ v-model="formgengduode.year"
|
|
|
|
+ :min="1"
|
|
|
|
+ :max="100"
|
|
|
|
+ label="描述文字"
|
|
|
|
+ ></el-input-number
|
|
|
|
+ ><span style="font-size: 16px; margin-left: 10px">年</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </div>
|
|
<div class="flex" style="justify-content: flex-start">
|
|
<div class="flex" style="justify-content: flex-start">
|
|
<el-button style="margin-top: 30px" type="success" @click="confirmPay()">微信支付</el-button>
|
|
<el-button style="margin-top: 30px" type="success" @click="confirmPay()">微信支付</el-button>
|
|
</div>
|
|
</div>
|
|
@@ -35,18 +78,29 @@
|
|
:modal-append-to-body="false"
|
|
:modal-append-to-body="false"
|
|
@close="close"
|
|
@close="close"
|
|
>
|
|
>
|
|
- <div class="pay" v-if="!isPaySuccess">
|
|
|
|
|
|
+ <div class="pay" v-if="!isPaySuccess && goodsList[goodsIndex]">
|
|
<div style="font-weight: bold; font-size: 22px">扫码支付</div>
|
|
<div style="font-weight: bold; font-size: 22px">扫码支付</div>
|
|
<div class="ewm" ref="payQRCode" />
|
|
<div class="ewm" ref="payQRCode" />
|
|
<div>
|
|
<div>
|
|
<div class="flex" style="align-items: center">
|
|
<div class="flex" style="align-items: center">
|
|
<div>
|
|
<div>
|
|
- 实付: <span style="font-size: 20px; color: #ff6804">¥</span
|
|
|
|
- ><span style="font-size: 36px; color: #ff6804; font-weight: bold">{{
|
|
|
|
- (goodsList[goodsIndex].normAmount * 100 - goodsList[goodsIndex].discountAmount * 100) / 100
|
|
|
|
- }}</span>
|
|
|
|
|
|
+ <template v-if="goodsId != '000'">
|
|
|
|
+ 实付:<span style="font-size: 20px; color: #ff6804">¥</span
|
|
|
|
+ ><span style="font-size: 36px; color: #ff6804; font-weight: bold">{{
|
|
|
|
+ (goodsList[goodsIndex].normAmount * 100 - goodsList[goodsIndex].discountAmount * 100) / 100
|
|
|
|
+ }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ 实付:<span style="font-size: 20px; color: #ff6804">¥</span
|
|
|
|
+ ><span style="font-size: 36px; color: #ff6804; font-weight: bold">{{
|
|
|
|
+ serviceProductList
|
|
|
|
+ .filter(item => !!~formgengduode.serviceProductList.indexOf(item.dictCode))
|
|
|
|
+ .map(item => item.price)
|
|
|
|
+ .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * formgengduode.year
|
|
|
|
+ }}</span>
|
|
|
|
+ </template>
|
|
</div>
|
|
</div>
|
|
- <div style="margin: 0 20px">
|
|
|
|
|
|
+ <div v-if="goodsId != '000'" style="margin: 0 20px">
|
|
已优惠: <span style="font-size: 18px; color: #ff6804">¥</span
|
|
已优惠: <span style="font-size: 18px; color: #ff6804">¥</span
|
|
><span style="font-size: 20px; color: #ff6804">{{ goodsList[goodsIndex].discountAmount }}</span>
|
|
><span style="font-size: 20px; color: #ff6804">{{ goodsList[goodsIndex].discountAmount }}</span>
|
|
</div>
|
|
</div>
|
|
@@ -67,15 +121,26 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="pay" v-else>
|
|
|
|
|
|
+ <div class="pay" v-else-if="goodsList[goodsIndex]">
|
|
<img style="width: 60px; height: 60px" src="@/assets/common/weixin.png" alt="" />
|
|
<img style="width: 60px; height: 60px" src="@/assets/common/weixin.png" alt="" />
|
|
<div style="font-weight: bold; font-size: 22px; margin: 20px 0">支付成功</div>
|
|
<div style="font-weight: bold; font-size: 22px; margin: 20px 0">支付成功</div>
|
|
<div class="flex" style="align-items: center">
|
|
<div class="flex" style="align-items: center">
|
|
<div style="font-size: 16px">
|
|
<div style="font-size: 16px">
|
|
- 支付金额: <span style="font-size: 20px; color: #ff6804">¥</span
|
|
|
|
- ><span style="font-size: 36px; color: #ff6804; font-weight: bold">{{
|
|
|
|
- (goodsList[goodsIndex].normAmount * 100 - goodsList[goodsIndex].discountAmount * 100) / 100
|
|
|
|
- }}</span>
|
|
|
|
|
|
+ <template v-if="goodsId != '000'">
|
|
|
|
+ 支付金额: <span style="font-size: 20px; color: #ff6804">¥</span
|
|
|
|
+ ><span style="font-size: 36px; color: #ff6804; font-weight: bold">{{
|
|
|
|
+ (goodsList[goodsIndex].normAmount * 100 - goodsList[goodsIndex].discountAmount * 100) / 100
|
|
|
|
+ }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ 支付金额: <span style="font-size: 20px; color: #ff6804">¥</span
|
|
|
|
+ ><span style="font-size: 36px; color: #ff6804; font-weight: bold">{{
|
|
|
|
+ serviceProductList
|
|
|
|
+ .filter(item => !!~formgengduode.serviceProductList.indexOf(item.dictCode))
|
|
|
|
+ .map(item => item.price)
|
|
|
|
+ .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * formgengduode.year
|
|
|
|
+ }}</span>
|
|
|
|
+ </template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="margin: 50px 0; font-size: 18px">
|
|
<div style="margin: 50px 0; font-size: 18px">
|
|
@@ -94,6 +159,7 @@ import { mapGetters } from 'vuex'
|
|
import { getUserInfo } from '@/api/setting'
|
|
import { getUserInfo } from '@/api/setting'
|
|
import QRCode from 'qrcodejs2'
|
|
import QRCode from 'qrcodejs2'
|
|
import request from '@/utils/request'
|
|
import request from '@/utils/request'
|
|
|
|
+import { serviceProductList } from '@/api/serviceProductConfig.js'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -104,7 +170,12 @@ export default {
|
|
timer: '',
|
|
timer: '',
|
|
is_pay: false,
|
|
is_pay: false,
|
|
is_submit: true,
|
|
is_submit: true,
|
|
- isPaySuccess: false
|
|
|
|
|
|
+ isPaySuccess: false,
|
|
|
|
+ formgengduode: {
|
|
|
|
+ year: 1,
|
|
|
|
+ serviceProductList: []
|
|
|
|
+ },
|
|
|
|
+ serviceProductList: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -113,6 +184,13 @@ export default {
|
|
created() {
|
|
created() {
|
|
this.getUserInfo()
|
|
this.getUserInfo()
|
|
this.getBuyList()
|
|
this.getBuyList()
|
|
|
|
+ serviceProductList({
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: -1,
|
|
|
|
+ params: [{ param: 'a.status', compare: '=', value: 'true' }]
|
|
|
|
+ }).then(res => {
|
|
|
|
+ this.serviceProductList = res.data.records
|
|
|
|
+ })
|
|
},
|
|
},
|
|
destroyed() {
|
|
destroyed() {
|
|
this.clear()
|
|
this.clear()
|
|
@@ -139,7 +217,19 @@ export default {
|
|
data: {}
|
|
data: {}
|
|
})
|
|
})
|
|
.then(res => {
|
|
.then(res => {
|
|
- this.goodsList = res.data
|
|
|
|
|
|
+ this.goodsList = [
|
|
|
|
+ ...res.data,
|
|
|
|
+ {
|
|
|
|
+ discountAmount: 0,
|
|
|
|
+ id: '000',
|
|
|
|
+ isFirst: 0,
|
|
|
|
+ month: 0,
|
|
|
|
+ normAmount: 0,
|
|
|
|
+ normName: '自定义',
|
|
|
|
+ remark: '',
|
|
|
|
+ year: 0
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
this.goodsId = res.data[0].id
|
|
this.goodsId = res.data[0].id
|
|
})
|
|
})
|
|
.catch(erro => {})
|
|
.catch(erro => {})
|
|
@@ -153,7 +243,6 @@ export default {
|
|
this.is_submit = true
|
|
this.is_submit = true
|
|
}, 3000)
|
|
}, 3000)
|
|
this.getCode()
|
|
this.getCode()
|
|
- this.is_pay = true
|
|
|
|
},
|
|
},
|
|
checkPay(payId) {
|
|
checkPay(payId) {
|
|
this.timer = setInterval(() => {
|
|
this.timer = setInterval(() => {
|
|
@@ -179,13 +268,24 @@ export default {
|
|
clear() {
|
|
clear() {
|
|
clearInterval(this.timer)
|
|
clearInterval(this.timer)
|
|
},
|
|
},
|
|
- getCode() {
|
|
|
|
|
|
+ funcsss() {
|
|
request({
|
|
request({
|
|
url: `/buy/service/generate/pay/code`,
|
|
url: `/buy/service/generate/pay/code`,
|
|
method: 'post',
|
|
method: 'post',
|
|
- params: {
|
|
|
|
|
|
+ data: {
|
|
id: this.userInfo.buyCompanyInfo,
|
|
id: this.userInfo.buyCompanyInfo,
|
|
- normId: this.goodsId
|
|
|
|
|
|
+ ...(() => {
|
|
|
|
+ if (this.goodsId == '000') {
|
|
|
|
+ return {
|
|
|
|
+ year: this.formgengduode.year,
|
|
|
|
+ serviceProductList: this.formgengduode.serviceProductList
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ normId: this.goodsId
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.then(res => {
|
|
.then(res => {
|
|
@@ -205,6 +305,22 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch(erro => {})
|
|
.catch(erro => {})
|
|
|
|
+ },
|
|
|
|
+ getCode() {
|
|
|
|
+ if (this.goodsId == '000') {
|
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.funcsss()
|
|
|
|
+ this.is_pay = true
|
|
|
|
+ } else {
|
|
|
|
+ console.log('error submit!!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.funcsss()
|
|
|
|
+ this.is_pay = true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|