Commit 904a46e0425539e3127ba5c182aac7742a29c664
1 parent
320132a0
卡券购买下单
Showing
4 changed files
with
144 additions
and
74 deletions
common/common.js
| ... | ... | @@ -40,6 +40,15 @@ const getCouponStaticQR = serverUrl + "/business/h5/couponsend/getCouponStaticQR |
| 40 | 40 | // 卡券申领明细总览 |
| 41 | 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 | 234 | getCouponDynamicQR, |
| 226 | 235 | getCouponStaticQR, |
| 227 | 236 | couponDetailSummary, |
| 237 | + createCouponOrder, | |
| 238 | + accountPay, | |
| 239 | + | |
| 228 | 240 | |
| 229 | 241 | //陈彪接口 |
| 230 | 242 | rechargeList, | ... | ... |
pages.json
| ... | ... | @@ -13,19 +13,20 @@ |
| 13 | 13 | }, |
| 14 | 14 | "pages": [ |
| 15 | 15 | // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
| 16 | - | |
| 17 | 16 | { |
| 18 | - "path": "pages/businessCard/buyCard", | |
| 17 | + "path": "pages/businessCard/businessCard", | |
| 19 | 18 | "style": { |
| 20 | - "navigationBarTitleText": "商户卡券购买" | |
| 19 | + "navigationBarTitleText": "商户卡券" | |
| 21 | 20 | } |
| 22 | 21 | }, |
| 22 | + | |
| 23 | 23 | { |
| 24 | - "path": "pages/businessCard/businessCard", | |
| 24 | + "path": "pages/businessCard/buyCard", | |
| 25 | 25 | "style": { |
| 26 | - "navigationBarTitleText": "商户卡券" | |
| 26 | + "navigationBarTitleText": "商户卡券购买" | |
| 27 | 27 | } |
| 28 | 28 | }, |
| 29 | + | |
| 29 | 30 | { |
| 30 | 31 | "path": "pages/businessCard/cardDetail", |
| 31 | 32 | "style": { | ... | ... |
pages/businessCard/businessCard.vue
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <uni-list-item title="适应车场" :rightText="i.plName"> |
| 10 | 10 | <text></text> |
| 11 | 11 | </uni-list-item> |
| 12 | - <uni-list-item :title="`价格: ¥${i.value}/张`" | |
| 12 | + <uni-list-item :title="`价格: ¥${$common.moneyFormat(i.value)}/张`" | |
| 13 | 13 | :rightText="`商户库存:${i.cardNum}张`"></uni-list-item> |
| 14 | 14 | </uni-list> |
| 15 | 15 | <view slot="actions" class="card-actions no-border"> | ... | ... |
pages/businessCard/buyCard.vue
| 1 | 1 | <template> |
| 2 | 2 | <view> |
| 3 | 3 | |
| 4 | - <uni-section title="2小时(时长券)" type="line" > | |
| 4 | + <uni-section :title="`${cardRuleName}(${cardTypeName})`" type="line"> | |
| 5 | 5 | <uni-card padding="0" spacing="0"> |
| 6 | 6 | <uni-list> |
| 7 | - <uni-list-item title="适应车场" rightText="万达商业广场" > | |
| 7 | + <uni-list-item title="适应车场" :rightText="plName"> | |
| 8 | 8 | <text></text> |
| 9 | 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 | 11 | </uni-list> |
| 12 | - | |
| 13 | 12 | </uni-card> |
| 14 | 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 | 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 | 21 | </template> |
| 23 | 22 | </uni-list-item> |
| 24 | - <uni-list-item title="应付金额" > | |
| 23 | + <uni-list-item title="应付金额"> | |
| 25 | 24 | <template v-slot:footer> |
| 26 | - <text style="color: red">¥25.00元</text> | |
| 25 | + <text style="color: red">¥{{ $common.moneyFormat(needPay)}}元</text> | |
| 27 | 26 | </template> |
| 28 | 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 | 30 | <template v-slot:header> |
| 32 | 31 | <text style="color: red">温馨提示</text> |
| 33 | 32 | </template> |
| ... | ... | @@ -35,68 +34,69 @@ |
| 35 | 34 | </uni-list> |
| 36 | 35 | |
| 37 | 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 | 38 | </view> |
| 40 | 39 | |
| 41 | 40 | <view> |
| 42 | 41 | <!-- 提示窗示例 --> |
| 43 | 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 | 45 | @close="dialogClose"></uni-popup-dialog> |
| 46 | 46 | </uni-popup> |
| 47 | 47 | </view> |
| 48 | 48 | <view class="formWrap"> |
| 49 | - <uni-forms ref="baseForm" :modelValue="baseFormData" > | |
| 49 | + <uni-forms ref="baseForm" :modelValue="baseFormData"> | |
| 50 | 50 | <uni-forms-item label="车牌号码" required> |
| 51 | - <uni-easyinput v-model="baseFormData.name" placeholder="请输入车牌号码" /> | |
| 51 | + <uni-easyinput v-model="baseFormData.name" placeholder="请输入车牌号码"/> | |
| 52 | 52 | </uni-forms-item> |
| 53 | 53 | |
| 54 | 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 | 57 | </uni-forms-item> |
| 57 | 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 | 61 | </uni-forms-item> |
| 60 | 62 | </uni-forms> |
| 61 | 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 | 102 | </view> |
| ... | ... | @@ -109,12 +109,10 @@ export default { |
| 109 | 109 | format: true |
| 110 | 110 | }) |
| 111 | 111 | return { |
| 112 | - vModelValue: 3, | |
| 113 | - | |
| 112 | + vModelValue: 1, | |
| 114 | 113 | benginDate: currentDate, |
| 115 | 114 | overDate: currentDate, |
| 116 | - | |
| 117 | - iconType:'auto', // 图标样式 | |
| 115 | + iconType: 'auto', // 图标样式 | |
| 118 | 116 | datetimesingle: '', |
| 119 | 117 | // 基础表单数据 |
| 120 | 118 | baseFormData: { |
| ... | ... | @@ -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 | 140 | onLoad(params) { |
| 136 | 141 | wx.showShareMenu({ |
| 137 | 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 | 155 | onShow() { |
| 142 | 156 | var me = this; |
| 143 | - | |
| 144 | 157 | }, |
| 145 | 158 | mounted() { |
| 146 | 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 | 164 | computed: { |
| 152 | 165 | startDate() { |
| ... | ... | @@ -157,6 +170,48 @@ export default { |
| 157 | 170 | } |
| 158 | 171 | }, |
| 159 | 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 | 215 | changeLog(e) { |
| 161 | 216 | console.log('change事件:', e); |
| 162 | 217 | }, |
| ... | ... | @@ -165,15 +220,15 @@ export default { |
| 165 | 220 | }, |
| 166 | 221 | dialogConfirm() { |
| 167 | 222 | console.log('点击确认') |
| 168 | - this.messageText = `点击确认了 ${this.msgType} 窗口` | |
| 169 | - this.$refs.message.open() | |
| 223 | + this.tobuy() | |
| 170 | 224 | }, |
| 171 | 225 | dialogToggle(type) { |
| 172 | - this.msgType = type | |
| 173 | 226 | this.$refs.alertDialog.open() |
| 174 | 227 | }, |
| 175 | 228 | changeValue(value) { |
| 176 | 229 | console.log('返回数值:', value); |
| 230 | + this.vModelValue = value | |
| 231 | + this.needPay = this.price * this.vModelValue | |
| 177 | 232 | }, |
| 178 | 233 | blur(e) { |
| 179 | 234 | console.log('blur:', e); |
| ... | ... | @@ -181,10 +236,10 @@ export default { |
| 181 | 236 | focus(e) { |
| 182 | 237 | console.log('focus:', e); |
| 183 | 238 | }, |
| 184 | - actionsClick(text){ | |
| 239 | + actionsClick(text) { | |
| 185 | 240 | uni.showToast({ |
| 186 | - title:text, | |
| 187 | - icon:'none' | |
| 241 | + title: text, | |
| 242 | + icon: 'none' | |
| 188 | 243 | }) |
| 189 | 244 | }, |
| 190 | 245 | bindPickerChange: function (e) { |
| ... | ... | @@ -225,9 +280,11 @@ export default { |
| 225 | 280 | background-color: #fff; |
| 226 | 281 | } |
| 227 | 282 | |
| 228 | - /deep/ .uni-section{ | |
| 283 | + /deep/ .uni-section { | |
| 229 | 284 | padding-bottom: 10px; |
| 230 | 285 | } |
| 231 | 286 | |
| 232 | - | |
| 287 | + /deep/ .uni-dialog-content-text{ | |
| 288 | + text-align: center; | |
| 289 | + } | |
| 233 | 290 | </style> | ... | ... |