Commit 904a46e0425539e3127ba5c182aac7742a29c664

Authored by 刘淇
1 parent 320132a0

卡券购买下单

common/common.js
@@ -40,6 +40,15 @@ const getCouponStaticQR = serverUrl + "/business/h5/couponsend/getCouponStaticQR @@ -40,6 +40,15 @@ const getCouponStaticQR = serverUrl + "/business/h5/couponsend/getCouponStaticQR
40 // 卡券申领明细总览 40 // 卡券申领明细总览
41 const couponDetailSummary = serverUrl + "/business/h5/couponIssued/couponDetailSummary"; 41 const couponDetailSummary = serverUrl + "/business/h5/couponIssued/couponDetailSummary";
42 42
  43 +// 商户卡券-卡券下单
  44 +const createCouponOrder = serverUrl + "/business/h5/coupon/createCouponOrder";
  45 +// 商户卡券-使用余额购买
  46 +const accountPay = serverUrl + "/business/h5/pay/busAccount/accountPay";
  47 +
  48 +
  49 +
  50 +
  51 +
43 //陈彪接口 52 //陈彪接口
44 53
45 // 余额明细下拉框选择列表 54 // 余额明细下拉框选择列表
@@ -225,6 +234,9 @@ export default { @@ -225,6 +234,9 @@ export default {
225 getCouponDynamicQR, 234 getCouponDynamicQR,
226 getCouponStaticQR, 235 getCouponStaticQR,
227 couponDetailSummary, 236 couponDetailSummary,
  237 + createCouponOrder,
  238 + accountPay,
  239 +
228 240
229 //陈彪接口 241 //陈彪接口
230 rechargeList, 242 rechargeList,
pages.json
@@ -13,19 +13,20 @@ @@ -13,19 +13,20 @@
13 }, 13 },
14 "pages": [ 14 "pages": [
15 // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages 15 // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
16 -  
17 { 16 {
18 - "path": "pages/businessCard/buyCard", 17 + "path": "pages/businessCard/businessCard",
19 "style": { 18 "style": {
20 - "navigationBarTitleText": "商户卡券购买" 19 + "navigationBarTitleText": "商户卡券"
21 } 20 }
22 }, 21 },
  22 +
23 { 23 {
24 - "path": "pages/businessCard/businessCard", 24 + "path": "pages/businessCard/buyCard",
25 "style": { 25 "style": {
26 - "navigationBarTitleText": "商户卡券" 26 + "navigationBarTitleText": "商户卡券购买"
27 } 27 }
28 }, 28 },
  29 +
29 { 30 {
30 "path": "pages/businessCard/cardDetail", 31 "path": "pages/businessCard/cardDetail",
31 "style": { 32 "style": {
pages/businessCard/businessCard.vue
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <uni-list-item title="适应车场" :rightText="i.plName"> 9 <uni-list-item title="适应车场" :rightText="i.plName">
10 <text></text> 10 <text></text>
11 </uni-list-item> 11 </uni-list-item>
12 - <uni-list-item :title="`价格: ¥${i.value}/张`" 12 + <uni-list-item :title="`价格: ¥${$common.moneyFormat(i.value)}/张`"
13 :rightText="`商户库存:${i.cardNum}张`"></uni-list-item> 13 :rightText="`商户库存:${i.cardNum}张`"></uni-list-item>
14 </uni-list> 14 </uni-list>
15 <view slot="actions" class="card-actions no-border"> 15 <view slot="actions" class="card-actions no-border">
pages/businessCard/buyCard.vue
1 <template> 1 <template>
2 <view> 2 <view>
3 3
4 - <uni-section title="2小时(时长券)" type="line" > 4 + <uni-section :title="`${cardRuleName}(${cardTypeName})`" type="line">
5 <uni-card padding="0" spacing="0"> 5 <uni-card padding="0" spacing="0">
6 <uni-list> 6 <uni-list>
7 - <uni-list-item title="适应车场" rightText="万达商业广场" > 7 + <uni-list-item title="适应车场" :rightText="plName">
8 <text></text> 8 <text></text>
9 </uni-list-item> 9 </uni-list-item>
10 - <uni-list-item title="价格:¥5/张" rightText="商户库存:0张"></uni-list-item> 10 + <uni-list-item :title="`价格:¥${$common.moneyFormat(price)}/张`" :rightText="`商户库存:${cardNum}张`"></uni-list-item>
11 </uni-list> 11 </uni-list>
12 -  
13 </uni-card> 12 </uni-card>
14 </uni-section> 13 </uni-section>
15 14
16 15
17 -  
18 - <uni-list >  
19 - <uni-list-item title="购买数量" > 16 + <uni-list>
  17 + <uni-list-item title="购买数量">
20 <template v-slot:footer> 18 <template v-slot:footer>
21 - <uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue" /> 19 + <uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue"
  20 + :max="cardNum" min="1"/>
22 </template> 21 </template>
23 </uni-list-item> 22 </uni-list-item>
24 - <uni-list-item title="应付金额" > 23 + <uni-list-item title="应付金额">
25 <template v-slot:footer> 24 <template v-slot:footer>
26 - <text style="color: red">¥25.00元</text> 25 + <text style="color: red">¥{{ $common.moneyFormat(needPay)}}元</text>
27 </template> 26 </template>
28 </uni-list-item> 27 </uni-list-item>
29 - <uni-list-item title="支付方式" rightText="商户余额" />  
30 - <uni-list-item note="请认真核对购买信息,卡券一经购买概不支持退款" > 28 + <uni-list-item title="支付方式" rightText="商户余额"/>
  29 + <uni-list-item note="请认真核对购买信息,卡券一经购买概不支持退款">
31 <template v-slot:header> 30 <template v-slot:header>
32 <text style="color: red">温馨提示</text> 31 <text style="color: red">温馨提示</text>
33 </template> 32 </template>
@@ -35,68 +34,69 @@ @@ -35,68 +34,69 @@
35 </uni-list> 34 </uni-list>
36 35
37 <view class="uni-padding-wrap uni-common-mt"> 36 <view class="uni-padding-wrap uni-common-mt">
38 - <button type="primary" @click="dialogToggle('warn')">立即购买</button> 37 + <button type="primary" @click="dialogToggle()">立即购买</button>
39 </view> 38 </view>
40 39
41 <view> 40 <view>
42 <!-- 提示窗示例 --> 41 <!-- 提示窗示例 -->
43 <uni-popup ref="alertDialog" type="dialog"> 42 <uni-popup ref="alertDialog" type="dialog">
44 - <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确定" title="提示" content="二次确定" @confirm="dialogConfirm" 43 + <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确定" title="提示" :content="`确定购买${cardRuleName}(${cardTypeName})${vModelValue}张\\n共支付${$common.moneyFormat(needPay)}元`"
  44 + @confirm="dialogConfirm"
45 @close="dialogClose"></uni-popup-dialog> 45 @close="dialogClose"></uni-popup-dialog>
46 </uni-popup> 46 </uni-popup>
47 </view> 47 </view>
48 <view class="formWrap"> 48 <view class="formWrap">
49 - <uni-forms ref="baseForm" :modelValue="baseFormData" > 49 + <uni-forms ref="baseForm" :modelValue="baseFormData">
50 <uni-forms-item label="车牌号码" required> 50 <uni-forms-item label="车牌号码" required>
51 - <uni-easyinput v-model="baseFormData.name" placeholder="请输入车牌号码" /> 51 + <uni-easyinput v-model="baseFormData.name" placeholder="请输入车牌号码"/>
52 </uni-forms-item> 52 </uni-forms-item>
53 53
54 <uni-forms-item label="生效时间"> 54 <uni-forms-item label="生效时间">
55 - <uni-datetime-picker :clear-icon="false" type="datetime" return-type="timestamp" v-model="baseFormData.datetimesingle"/> 55 + <uni-datetime-picker :clear-icon="false" type="datetime" return-type="timestamp"
  56 + v-model="baseFormData.datetimesingle"/>
56 </uni-forms-item> 57 </uni-forms-item>
57 <uni-forms-item label="失效时间"> 58 <uni-forms-item label="失效时间">
58 - <uni-datetime-picker :clear-icon="false" type="datetime" return-type="timestamp" v-model="baseFormData.datetimesingle"/> 59 + <uni-datetime-picker :clear-icon="false" type="datetime" return-type="timestamp"
  60 + v-model="baseFormData.datetimesingle"/>
59 </uni-forms-item> 61 </uni-forms-item>
60 </uni-forms> 62 </uni-forms>
61 </view> 63 </view>
62 - <uni-section title="24小时(包天券)" type="line" >  
63 - <uni-card padding="0" spacing="0"> 64 + <!--<uni-section title="24小时(包天券)" type="line" >-->
  65 + <!--<uni-card padding="0" spacing="0">-->
64 66
65 - <uni-list>  
66 - <uni-list-item title="适应车场" rightText="万达商业广场" >  
67 - <text></text>  
68 - </uni-list-item>  
69 - <uni-list-item title="价格:¥5/张" rightText="商户库存:0张"></uni-list-item>  
70 - </uni-list> 67 + <!--<uni-list>-->
  68 + <!--<uni-list-item title="适应车场" rightText="万达商业广场" >-->
  69 + <!--<text></text>-->
  70 + <!--</uni-list-item>-->
  71 + <!--<uni-list-item title="价格:¥5/张" rightText="商户库存:0张"></uni-list-item>-->
  72 + <!--</uni-list>-->
71 73
72 - </uni-card>  
73 - </uni-section> 74 + <!--</uni-card>-->
  75 + <!--</uni-section>-->
74 76
75 77
  78 + <!--<uni-list >-->
  79 + <!--<uni-list-item title="购买数量" >-->
  80 + <!--<template v-slot:footer>-->
  81 + <!--<uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue" />-->
  82 + <!--</template>-->
  83 + <!--</uni-list-item>-->
  84 + <!--<uni-list-item title="应付金额" >-->
  85 + <!--<template v-slot:footer>-->
  86 + <!--<text style="color: red">¥25.00元</text>-->
  87 + <!--</template>-->
  88 + <!--</uni-list-item>-->
  89 + <!--<uni-list-item title="支付方式" rightText="商户余额" />-->
  90 + <!--<uni-list-item note="请认真核对购买信息,卡券一经购买概不支持退款" >-->
  91 + <!--<template v-slot:header>-->
  92 + <!--<text style="color: red">温馨提示</text>-->
  93 + <!--</template>-->
  94 + <!--</uni-list-item>-->
  95 + <!--</uni-list>-->
76 96
77 - <uni-list >  
78 - <uni-list-item title="购买数量" >  
79 - <template v-slot:footer>  
80 - <uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue" />  
81 - </template>  
82 - </uni-list-item>  
83 - <uni-list-item title="应付金额" >  
84 - <template v-slot:footer>  
85 - <text style="color: red">¥25.00元</text>  
86 - </template>  
87 - </uni-list-item>  
88 - <uni-list-item title="支付方式" rightText="商户余额" />  
89 - <uni-list-item note="请认真核对购买信息,卡券一经购买概不支持退款" >  
90 - <template v-slot:header>  
91 - <text style="color: red">温馨提示</text>  
92 - </template>  
93 - </uni-list-item>  
94 - </uni-list>  
95 -  
96 - <view class="uni-padding-wrap uni-common-mt">  
97 - <button type="primary" @click="dialogToggle('warn')">立即购买</button>  
98 - </view>  
99 - 97 + <!--<view class="uni-padding-wrap uni-common-mt">-->
  98 + <!--<button type="primary" @click="dialogToggle('warn')">立即购买</button>-->
  99 + <!--</view>-->
100 100
101 101
102 </view> 102 </view>
@@ -109,12 +109,10 @@ export default { @@ -109,12 +109,10 @@ export default {
109 format: true 109 format: true
110 }) 110 })
111 return { 111 return {
112 - vModelValue: 3,  
113 - 112 + vModelValue: 1,
114 benginDate: currentDate, 113 benginDate: currentDate,
115 overDate: currentDate, 114 overDate: currentDate,
116 -  
117 - iconType:'auto', // 图标样式 115 + iconType: 'auto', // 图标样式
118 datetimesingle: '', 116 datetimesingle: '',
119 // 基础表单数据 117 // 基础表单数据
120 baseFormData: { 118 baseFormData: {
@@ -130,23 +128,38 @@ export default { @@ -130,23 +128,38 @@ export default {
130 }] 128 }]
131 } 129 }
132 }, 130 },
  131 + cardTypeName: '',// 卡类型名称
  132 + cardRuleName: '',// 卡名称
  133 + plName: '', // 停车场
  134 + price: '', // 卡价格
  135 + cardNum: '', // 库存
  136 + needPay: 0, // 应付
  137 + cardRuleNo: '',
133 } 138 }
134 }, 139 },
135 onLoad(params) { 140 onLoad(params) {
136 wx.showShareMenu({ 141 wx.showShareMenu({
137 withShareTicket: true 142 withShareTicket: true
138 }) 143 })
139 - 144 + let option = JSON.parse(params.optionData)
  145 + console.log(option)
  146 + this.cardRelParkNo = option.cardRelParkNo
  147 + this.cardRuleNo = option.cardRuleNo
  148 + this.cardTypeName = option.cardTypeName
  149 + this.cardRuleName = option.cardRuleName
  150 + this.plName = option.plName
  151 + this.price = option.value
  152 + this.cardNum = option.cardNum
  153 + this.needPay = this.price * this.vModelValue
140 }, 154 },
141 onShow() { 155 onShow() {
142 var me = this; 156 var me = this;
143 -  
144 }, 157 },
145 mounted() { 158 mounted() {
146 setTimeout(() => { 159 setTimeout(() => {
147 - this.baseFormData.datetimesingle = Date.now() - 2*24*3600*1000  
148 - this.datetimesingle = Date.now() - 2*24*3600*1000  
149 - },500) 160 + this.baseFormData.datetimesingle = Date.now() - 2 * 24 * 3600 * 1000
  161 + this.datetimesingle = Date.now() - 2 * 24 * 3600 * 1000
  162 + }, 500)
150 }, 163 },
151 computed: { 164 computed: {
152 startDate() { 165 startDate() {
@@ -157,6 +170,48 @@ export default { @@ -157,6 +170,48 @@ export default {
157 } 170 }
158 }, 171 },
159 methods: { 172 methods: {
  173 + tobuy() {
  174 + let that = this
  175 + let paramsData = {
  176 + buyNum: this.vModelValue,
  177 + totalPrice: this.needPay,
  178 + cardRelParkNo: this.cardRelParkNo,
  179 + cardRuleNo: this.cardRuleNo
  180 + }
  181 + // 首页信息获取 接口
  182 + that.$myRequest({
  183 + url: that.$common.createCouponOrder,
  184 + method: 'POST',
  185 + data: that.$common.requestSign(paramsData)
  186 + }).then(res => {
  187 + console.log(res)
  188 + let orderId = res.data.orderId
  189 + this.accountPay(orderId)
  190 + })
  191 + },
  192 + accountPay(orderId){
  193 + let that = this
  194 + let paramsData = {
  195 + payType: '35', // '35' 商户余额支付
  196 + paySrcType: '501', // '101' : 停车付款单, '501': '商户优惠券购买'
  197 + orderId: orderId,
  198 + payFee: this.needPay
  199 + }
  200 + // 首页信息获取 接口
  201 + that.$myRequest({
  202 + url: that.$common.accountPay,
  203 + method: 'POST',
  204 + data: that.$common.requestSign(paramsData)
  205 + }).then(res => {
  206 + console.log(res)
  207 + uni.showToast({
  208 + title: '购买成功',
  209 + icon: 'success',
  210 + duration: 1000
  211 + })
  212 +
  213 + })
  214 + },
160 changeLog(e) { 215 changeLog(e) {
161 console.log('change事件:', e); 216 console.log('change事件:', e);
162 }, 217 },
@@ -165,15 +220,15 @@ export default { @@ -165,15 +220,15 @@ export default {
165 }, 220 },
166 dialogConfirm() { 221 dialogConfirm() {
167 console.log('点击确认') 222 console.log('点击确认')
168 - this.messageText = `点击确认了 ${this.msgType} 窗口`  
169 - this.$refs.message.open() 223 + this.tobuy()
170 }, 224 },
171 dialogToggle(type) { 225 dialogToggle(type) {
172 - this.msgType = type  
173 this.$refs.alertDialog.open() 226 this.$refs.alertDialog.open()
174 }, 227 },
175 changeValue(value) { 228 changeValue(value) {
176 console.log('返回数值:', value); 229 console.log('返回数值:', value);
  230 + this.vModelValue = value
  231 + this.needPay = this.price * this.vModelValue
177 }, 232 },
178 blur(e) { 233 blur(e) {
179 console.log('blur:', e); 234 console.log('blur:', e);
@@ -181,10 +236,10 @@ export default { @@ -181,10 +236,10 @@ export default {
181 focus(e) { 236 focus(e) {
182 console.log('focus:', e); 237 console.log('focus:', e);
183 }, 238 },
184 - actionsClick(text){ 239 + actionsClick(text) {
185 uni.showToast({ 240 uni.showToast({
186 - title:text,  
187 - icon:'none' 241 + title: text,
  242 + icon: 'none'
188 }) 243 })
189 }, 244 },
190 bindPickerChange: function (e) { 245 bindPickerChange: function (e) {
@@ -225,9 +280,11 @@ export default { @@ -225,9 +280,11 @@ export default {
225 background-color: #fff; 280 background-color: #fff;
226 } 281 }
227 282
228 - /deep/ .uni-section{ 283 + /deep/ .uni-section {
229 padding-bottom: 10px; 284 padding-bottom: 10px;
230 } 285 }
231 286
232 - 287 + /deep/ .uni-dialog-content-text{
  288 + text-align: center;
  289 + }
233 </style> 290 </style>