Commit aabd3df4cc6403d5624370cf254e7674e4e83a34
1 parent
8b40a4fc
购买会员卡
Showing
10 changed files
with
517 additions
and
102 deletions
src/api/cards/cards.js
| ... | ... | @@ -20,6 +20,66 @@ export function queryVipAreaCardByOrgId(params) { |
| 20 | 20 | }) |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | +// | |
| 24 | +// // 搜索有会员卡的停车场 | |
| 25 | +// export function queryParkListForVipCard(params) { | |
| 26 | +// return request({ | |
| 27 | +// url: 'applyVipCard/queryParkListForVipCard', | |
| 28 | +// method: 'post', | |
| 29 | +// data: params | |
| 30 | +// }) | |
| 31 | +// } | |
| 32 | + | |
| 33 | + | |
| 34 | +// 搜索停车场 | |
| 35 | +export function queryParkListForVipCard(params) { | |
| 36 | + return request({ | |
| 37 | + url: 'applyVipCard/queryParkListForVipCard', | |
| 38 | + method: 'post', | |
| 39 | + data: params | |
| 40 | + }) | |
| 41 | +} | |
| 42 | + | |
| 43 | +// 搜索卡类型 | |
| 44 | +export function queryVipCardInfoByPlNo(params) { | |
| 45 | + return request({ | |
| 46 | + url: 'applyVipCard/queryVipCardInfoByPlNo', | |
| 47 | + method: 'post', | |
| 48 | + data: params | |
| 49 | + }) | |
| 50 | +} | |
| 51 | + | |
| 52 | +// 获取用户车牌 | |
| 53 | +export function queryUserCars(params) { | |
| 54 | + return request({ | |
| 55 | + url: 'user/queryUserCars', | |
| 56 | + method: 'post', | |
| 57 | + data: params | |
| 58 | + }) | |
| 59 | +} | |
| 60 | + | |
| 61 | +// 创建订单 | |
| 62 | +export function createVipCardOrder(params) { | |
| 63 | + return request({ | |
| 64 | + url: 'vip/createVipCardOrder', | |
| 65 | + method: 'post', | |
| 66 | + data: params | |
| 67 | + }) | |
| 68 | +} | |
| 69 | + | |
| 70 | + | |
| 71 | +// 会员卡-微信支付 | |
| 72 | +export function weixinpay(params) { | |
| 73 | + return request({ | |
| 74 | + url: 'weixinpay/publicUnifiedOrder', | |
| 75 | + method: 'post', | |
| 76 | + data: params | |
| 77 | + }) | |
| 78 | +} | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 23 | 83 | |
| 24 | 84 | |
| 25 | 85 | ... | ... |
src/main.js
src/utils/request.js
| ... | ... | @@ -5,7 +5,7 @@ import axios from 'axios' |
| 5 | 5 | const service = axios.create({ |
| 6 | 6 | // http://dev.renniting.cn/pay/ 赤峰测试 |
| 7 | 7 | // http://pay.service.renniting.cn/ 赤峰 |
| 8 | - baseURL: 'http://dev.renniting.cn/pay/', // url = base url + request url | |
| 8 | + baseURL: 'http://pay.service.renniting.cn/', // url = base url + request url | |
| 9 | 9 | // withCredentials: true, // send cookies when cross-domain requests |
| 10 | 10 | timeout: 6000 // request timeout |
| 11 | 11 | }) |
| ... | ... | @@ -25,6 +25,7 @@ service.interceptors.request.use( |
| 25 | 25 | service.interceptors.response.use( |
| 26 | 26 | response => { |
| 27 | 27 | const res = response.data |
| 28 | + // console.log(res) | |
| 28 | 29 | // if the custom code is not 20000, it is judged as an error. |
| 29 | 30 | if (res.code != '8888') { |
| 30 | 31 | return res | ... | ... |
src/utils/utils.js
| ... | ... | @@ -41,9 +41,14 @@ export default { |
| 41 | 41 | } |
| 42 | 42 | }, |
| 43 | 43 | timestampToTime: function(timestamp) { |
| 44 | - var d = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 | |
| 45 | - var youWant = d.getFullYear() + "-" + this.completedString(d.getMonth() + 1) + "-" + this.completedString(d.getDate()); | |
| 46 | - return youWant; | |
| 44 | + if(timestamp){ | |
| 45 | + var d = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 | |
| 46 | + var youWant = d.getFullYear() + "-" + this.completedString(d.getMonth() + 1) + "-" + this.completedString(d.getDate()); | |
| 47 | + return youWant; | |
| 48 | + }else{ | |
| 49 | + return '' | |
| 50 | + } | |
| 51 | + | |
| 47 | 52 | }, |
| 48 | 53 | timestampTransformTime: function(timestamp) { |
| 49 | 54 | var d = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 |
| ... | ... | @@ -150,13 +155,14 @@ export default { |
| 150 | 155 | // ud8yq5tv0inxupc05xfeau39jywlqoj2 新的id |
| 151 | 156 | // ny1u72b6k374sg379z0kqjgfxe2ycnpw 新的签名 |
| 152 | 157 | myVarAppid: "65grtq5tv0wewec05xfeau39jyghhjm",// 公共请求Appid |
| 153 | - myDeviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", // 公共请求设备信息 | |
| 158 | + myDeviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", // 公共请求设备信息 80ac1a4218beb19a BC0703A4-AFB0-4B51-9089-9B7487C0CC6E | |
| 154 | 159 | myVxAppId: "wxdfb0276f85514ea3", |
| 155 | 160 | // 测试环境 微信赤峰 appid wxff4cebaedbf4f886 |
| 156 | 161 | // 微信赤峰 appid wx2af2bab90d433c86 |
| 157 | 162 | // 黄石 appid wxa1a66cc7d263afe6 |
| 158 | 163 | // 阳明 wxdfb0276f85514ea3 |
| 159 | - myOrgId: "10193", // 归属地 赤峰id 10003 黄石 10079 无锡10005 | |
| 164 | + // 无锡 wx1e9001e5940605b1 | |
| 165 | + myOrgId: "10193", // 归属地 赤峰id 10003 黄石 10079 无锡10005 扬明10193 | |
| 160 | 166 | myGetSign: function(objb) { // 获取签名 |
| 161 | 167 | var compare = function(obj1, obj2) { |
| 162 | 168 | var val1 = obj1.keyname; |
| ... | ... | @@ -203,7 +209,7 @@ export default { |
| 203 | 209 | deviceInfo: this.myDeviceInfo, |
| 204 | 210 | salt: salt, |
| 205 | 211 | sign_type: "md5", |
| 206 | - token: '7f61e743f9e24f86b1673e32c16e181e', //7f61e743f9e24f86b1673e32c16e181e sessionStorage.getItem("wx_Token") | |
| 212 | + token: sessionStorage.getItem("wx_Token"), //de8eb9cce14b4c8f81d027fcda0b78f8 sessionStorage.getItem("wx_Token") | |
| 207 | 213 | orgId: this.myOrgId |
| 208 | 214 | }; |
| 209 | 215 | return reqData; | ... | ... |
src/views/carManage/addCar.vue
| ... | ... | @@ -457,13 +457,23 @@ export default { |
| 457 | 457 | userCarsInfoEdit(jsondata).then(data => { |
| 458 | 458 | console.log(data) |
| 459 | 459 | if (data.code == 0) { |
| 460 | - this.$router.push({ | |
| 461 | - path: "myCars", | |
| 462 | - // query: { | |
| 463 | - // carNumber: plateLicense, | |
| 464 | - // carNumberColor: this.currentColor | |
| 465 | - // } | |
| 466 | - }); | |
| 460 | + | |
| 461 | + // source:1 // 1表示来源是购买车牌页面 | |
| 462 | + | |
| 463 | + if(this.$route.query.source){ | |
| 464 | + this.$router.push({ | |
| 465 | + path: "buyCard", | |
| 466 | + }); | |
| 467 | + }else{ | |
| 468 | + this.$router.push({ | |
| 469 | + path: "myCars", | |
| 470 | + // query: { | |
| 471 | + // carNumber: plateLicense, | |
| 472 | + // carNumberColor: this.currentColor | |
| 473 | + // } | |
| 474 | + }); | |
| 475 | + } | |
| 476 | + | |
| 467 | 477 | }else{ |
| 468 | 478 | this.$vux.toast.text(data.message, 'top') |
| 469 | 479 | } | ... | ... |
src/views/carManage/certification.vue
| ... | ... | @@ -66,7 +66,7 @@ export default { |
| 66 | 66 | let params = new FormData(); |
| 67 | 67 | params.append("picFile", this.fil); |
| 68 | 68 | params.append("fileType", 7); |
| 69 | - params.append("token", "7f61e743f9e24f86b1673e32c16e181e"); | |
| 69 | + params.append("token", sessionStorage.getItem("wx_Token")); // sessionStorage.getItem("wx_Token") | |
| 70 | 70 | uploadPic(params).then(data => { |
| 71 | 71 | console.log(data); |
| 72 | 72 | if (data.code == 0) { | ... | ... |
src/views/cards/CardList.vue
| ... | ... | @@ -46,12 +46,12 @@ export default { |
| 46 | 46 | } |
| 47 | 47 | }, |
| 48 | 48 | mounted(){ |
| 49 | - this.queryVipAreaCardByOrgId() | |
| 49 | + this.queryParkListForVipCard() | |
| 50 | 50 | }, |
| 51 | 51 | methods:{ |
| 52 | - queryVipAreaCardByOrgId: function() { | |
| 52 | + queryParkListForVipCard: function() { | |
| 53 | 53 | let jsondata = this.$utils.commonParams(); |
| 54 | - jsondata.saleChannel = '3' // 售卖渠道:1-APP、2-公众号、3-平台 | |
| 54 | + jsondata.saleChannel = '2' // 售卖渠道:1-APP、2-公众号、3-平台 | |
| 55 | 55 | jsondata.sign = this.$utils.signObject(jsondata); |
| 56 | 56 | queryVipAreaCardByOrgId(jsondata).then(data => { |
| 57 | 57 | console.log(data); | ... | ... |
src/views/cards/Cards.vue
| 1 | 1 | <template> |
| 2 | 2 | <div style="height: 100%;display: flex;flex-direction: column;"> |
| 3 | 3 | <div style="flex: 1;overflow-y: auto;padding: 15px"> |
| 4 | - <div v-if="cardList.length == 0" class="noCardData"> | |
| 4 | + <div class="noCardData" v-if="cardList.length == 0"> | |
| 5 | 5 | <p>您目前没有任何会员卡,</p> |
| 6 | 6 | <p>请绑定车牌通过认证后再购买会员卡!</p> |
| 7 | 7 | </div> |
| 8 | - <div class="cardBg"> | |
| 9 | - <ul class="cardList"> | |
| 10 | - <li> | |
| 11 | - 会员卡- 月卡 | |
| 12 | - </li> | |
| 13 | - <li> | |
| 14 | - 绑定车牌号: 京A12312 | |
| 15 | - </li> | |
| 16 | - <li> | |
| 17 | - 有效时间段: 2021-11-11 至 2021-12-10 | |
| 18 | - </li> | |
| 19 | - <li> | |
| 20 | - 适用停车场: 万达停车场 | |
| 21 | - </li> | |
| 22 | - </ul> | |
| 23 | - </div> | |
| 24 | - <div class="cardBg"> | |
| 25 | - <ul class="cardList"> | |
| 26 | - <li> | |
| 27 | - 会员卡- 月卡 | |
| 28 | - </li> | |
| 29 | - <li> | |
| 30 | - 绑定车牌号: 京A12312 | |
| 31 | - </li> | |
| 32 | - <li> | |
| 33 | - 有效时间段: 2021-11-11 至 2021-12-10 | |
| 34 | - </li> | |
| 35 | - <li> | |
| 36 | - 适用停车场: 万达停车场 | |
| 37 | - </li> | |
| 38 | - </ul> | |
| 8 | + | |
| 9 | + <div v-else> | |
| 10 | + <div class="cardBg" v-for="(i ,index) in cardList"> | |
| 11 | + <ul class="cardList"> | |
| 12 | + <li> | |
| 13 | + 会员卡- {{i.cardType=='1'?'年卡':(i.cardType=='2'?'半年卡':(i.cardType=='3'?'季卡':(i.cardType=='4'?'月卡':(i.cardType=='5'?'日卡':''))))}} | |
| 14 | + </li> | |
| 15 | + <li> | |
| 16 | + 绑定车牌号: {{ i.carNumber }} | |
| 17 | + </li> | |
| 18 | + <li> | |
| 19 | + 有效时间段: {{i.effDate}} 至 {{i.expDate}} | |
| 20 | + </li> | |
| 21 | + <li> | |
| 22 | + 卡名称: {{ i.cardName }} | |
| 23 | + </li> | |
| 24 | + </ul> | |
| 25 | + </div> | |
| 26 | + <!--cardType=='1'?'年卡':(cardType=='2'?'半年卡':(cardType=='3'?'季卡':(cardType=='4'?'月卡':(cardType=='5'?'日卡':''))))--> | |
| 27 | + | |
| 28 | + | |
| 39 | 29 | </div> |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 40 | 33 | </div> |
| 41 | - <x-button type="primary" @click.native="$router.push({path:'CardList'})">购买会员卡</x-button> | |
| 34 | + <x-button type="primary" @click.native="$router.push({path:'buyCard'})">购买会员卡</x-button> | |
| 42 | 35 | </div> |
| 43 | 36 | </template> |
| 44 | 37 | |
| ... | ... | @@ -62,6 +55,7 @@ export default { |
| 62 | 55 | console.log(data); |
| 63 | 56 | if (data.code == 0) { |
| 64 | 57 | let res = data.data; |
| 58 | + this.cardList = res | |
| 65 | 59 | } else { |
| 66 | 60 | this.$vux.toast.text(data.message, "top"); |
| 67 | 61 | } | ... | ... |
src/views/cards/buyCard.vue
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | 3 | <ul class="choose-area"> |
| 4 | + | |
| 5 | + | |
| 4 | 6 | <li> |
| 5 | - <div style="color: #666">卡名称</div> | |
| 6 | - <div>微纳园卡</div> | |
| 7 | + <div style="color: #666">选择停车场</div> | |
| 8 | + <div @click="parkNameVisible = true">{{parkName}}</div> | |
| 9 | + <div class="arrow">></div> | |
| 10 | + <!--<div class="arrow">></div>--> | |
| 7 | 11 | </li> |
| 8 | 12 | |
| 13 | + | |
| 14 | + <!--<li>--> | |
| 15 | + <!--<div style="color: #666">卡名称</div>--> | |
| 16 | + <!--<div>微纳园卡</div>--> | |
| 17 | + <!--</li>--> | |
| 18 | + | |
| 9 | 19 | <li> |
| 10 | 20 | <div style="color: #666">选择卡类型</div> |
| 11 | - <div>{{carType}}</div> | |
| 21 | + <div @click="cardTypeListVisible = true">{{carType}}</div> | |
| 22 | + <div class="arrow">></div> | |
| 12 | 23 | <!--<div class="arrow">></div>--> |
| 13 | 24 | </li> |
| 14 | 25 | |
| ... | ... | @@ -27,7 +38,7 @@ |
| 27 | 38 | |
| 28 | 39 | <li> |
| 29 | 40 | <div style="color: #666">有效期至</div> |
| 30 | - <div>{{ $utils.timestampToTime(endDate)}}</div> | |
| 41 | + <div>{{ $utils.timestampToTime(endTimeFunc) }}</div> | |
| 31 | 42 | </li> |
| 32 | 43 | |
| 33 | 44 | |
| ... | ... | @@ -42,33 +53,41 @@ |
| 42 | 53 | |
| 43 | 54 | <li> |
| 44 | 55 | <div style="color: #666">单价</div> |
| 45 | - <div>¥{{unitPrice}}</div> | |
| 56 | + <div>¥{{ (unitPrice/100).toFixed(2)}}</div> | |
| 46 | 57 | </li> |
| 47 | 58 | |
| 48 | 59 | |
| 49 | 60 | <li> |
| 50 | 61 | <div style="color: #666">优惠金额</div> |
| 51 | - <div>¥0.00</div> | |
| 62 | + <div>¥{{(disPrice/100).toFixed(2)}}</div> | |
| 52 | 63 | </li> |
| 53 | 64 | |
| 54 | 65 | <li> |
| 55 | 66 | <div style="color: #666">应付金额</div> |
| 56 | - <div style="color: #A31414">¥{{needPay}}</div> | |
| 67 | + <div style="color: #A31414">¥{{(needPay/100).toFixed(2)}}</div> | |
| 57 | 68 | </li> |
| 58 | 69 | |
| 59 | 70 | </ul> |
| 60 | 71 | |
| 61 | - <div class="parkArea leftRightPadding"> | |
| 62 | - <p class="parkAreaTitle"> | |
| 63 | - <span>本卡同时适用于以下停车场:</span> | |
| 64 | - <span class="parkMore" @click="parkMoreVisible = true">查看更多</span> | |
| 72 | + <!--<div class="parkArea leftRightPadding">--> | |
| 73 | + <!--<p class="parkAreaTitle">--> | |
| 74 | + <!--<span>本卡同时适用于以下停车场:</span>--> | |
| 75 | + <!--<span class="parkMore" @click="parkMoreVisible = true">查看更多</span>--> | |
| 76 | + <!--</p>--> | |
| 77 | + | |
| 78 | + <!--<p>停车场停车场停车停车场</p>--> | |
| 79 | + <!--</div>--> | |
| 80 | + <div style="padding:15px;text-align: center"> | |
| 81 | + <check-icon :value.sync="agreement"> | |
| 82 | + </check-icon> | |
| 83 | + <p style="display: inline-block;height: 23px;line-height: 23px;">我已阅读并同意 <span style="color: blue" | |
| 84 | + @click="showHideOnBlur=true">《购买须知》</span> | |
| 65 | 85 | </p> |
| 66 | - | |
| 67 | - <p>停车场停车场停车停车场</p> | |
| 68 | 86 | </div> |
| 69 | 87 | |
| 88 | + | |
| 70 | 89 | <div style="margin-top: 34px" class="leftRightPadding"> |
| 71 | - <mt-button type="danger" size="large">确定购买</mt-button> | |
| 90 | + <mt-button type="danger" size="large" @click="toPay">确定购买</mt-button> | |
| 72 | 91 | </div> |
| 73 | 92 | |
| 74 | 93 | <!-- @touchmove.prevent 阻止默认事件,在选择时间时阻止页面也跟着滚动--> |
| ... | ... | @@ -86,12 +105,19 @@ |
| 86 | 105 | ></mt-datetime-picker> |
| 87 | 106 | </div> |
| 88 | 107 | |
| 108 | + <!--停车场--> | |
| 109 | + <mt-actionsheet | |
| 110 | + :actions="parkNameList" | |
| 111 | + v-model="parkNameVisible"> | |
| 112 | + </mt-actionsheet> | |
| 89 | 113 | |
| 114 | + <!--卡类型--> | |
| 90 | 115 | <mt-actionsheet |
| 91 | - :actions="actions" | |
| 92 | - v-model="popupVisible"> | |
| 116 | + :actions="cardTypeList" | |
| 117 | + v-model="cardTypeListVisible"> | |
| 93 | 118 | </mt-actionsheet> |
| 94 | 119 | |
| 120 | + <!--车牌号--> | |
| 95 | 121 | <mt-actionsheet |
| 96 | 122 | :actions="carNumList" |
| 97 | 123 | v-model="carNumberVisible"> |
| ... | ... | @@ -105,76 +131,371 @@ |
| 105 | 131 | </ul> |
| 106 | 132 | </mt-popup> |
| 107 | 133 | |
| 134 | + <div v-transfer-dom> | |
| 135 | + <x-dialog v-model="showHideOnBlur" class="dialog-demo" hide-on-blur> | |
| 136 | + <div class="agreen-box"> | |
| 137 | + <p> | |
| 138 | + 1. 本停车卡为指定停车场有效使用,为特定的场地停车权限,请按照停车场场地自主选择购买。 | |
| 139 | + </p> | |
| 140 | + <p> | |
| 141 | + 2. 月卡(季卡)一经售出,概不退卡,允许车牌变更1次(有效期内)。 | |
| 142 | + </p> | |
| 143 | + <p> | |
| 144 | + 3. 年卡可以支持车牌变更3次(有效期内),年卡退卡需要按照原价扣除已经使用月份(不满一个月按照一个月计算)并退回已开具发票。 | |
| 145 | + </p> | |
| 146 | + <p> | |
| 147 | + 4. 停车场管理方对车辆及车内财务无看管保全义务,车主须遵守停车场管理规定将车辆停在车场的停车位内,乱停车辆引起的贴条和拖车等后果由车主自行承担。 | |
| 148 | + </p> | |
| 149 | + <p> | |
| 150 | + 5. 友情提醒:妥善关闭和锁定已停车入位的车辆,不在车内放置现金和其它贵重物品,其它停车规定须遵守所辖停车场的管理规定(参见停车场公示)。 | |
| 151 | + </p> | |
| 152 | + </div> | |
| 153 | + <div @click="showHideOnBlur=false"> | |
| 154 | + <span class="vux-close">X</span> | |
| 155 | + </div> | |
| 156 | + </x-dialog> | |
| 157 | + </div> | |
| 158 | + | |
| 159 | + | |
| 108 | 160 | </div> |
| 109 | 161 | </template> |
| 110 | 162 | |
| 111 | 163 | <script> |
| 164 | +import { TransferDomDirective as TransferDom } from "vux"; | |
| 165 | +import { | |
| 166 | + queryParkListForVipCard, | |
| 167 | + queryVipCardInfoByPlNo, | |
| 168 | + queryUserCars, | |
| 169 | + weixinpay, | |
| 170 | + createVipCardOrder | |
| 171 | +} from "@/api/cards/cards"; | |
| 112 | 172 | import { timestampToTime } from "../../utils/utils.js"; |
| 113 | 173 | export default { |
| 114 | 174 | name: "buyCard", |
| 175 | + directives: { | |
| 176 | + TransferDom | |
| 177 | + }, | |
| 115 | 178 | data() { |
| 116 | 179 | return { |
| 117 | 180 | startDate: new Date(), |
| 118 | 181 | dateVal: "", |
| 119 | 182 | selectedValue: "", |
| 120 | - startData: new Date(), | |
| 121 | - endDate: new Date(), | |
| 122 | - popupVisible: false, | |
| 123 | - actions: [ | |
| 124 | - { name: "月卡", num: 1, method: this.clickAction }, | |
| 125 | - { name: "季卡", num: 3, method: this.clickAction }, | |
| 126 | - { name: "年卡", num: 12, method: this.clickAction } | |
| 127 | - ], | |
| 128 | - carType: "月卡", | |
| 183 | + startData: "", | |
| 184 | + endDate: "", | |
| 185 | + parkName: "请点击选择", | |
| 186 | + parkNameVisible: false, | |
| 187 | + parkNameList: [], // 停车场 | |
| 188 | + parkNo: "", | |
| 189 | + cardTypeListVisible: false, | |
| 190 | + cardTypeList: [], // 卡类型 | |
| 191 | + carType: "请点击选择", | |
| 129 | 192 | carNumList: [ |
| 130 | - { name: "停车场1", method: this.clickActionCarNum }, | |
| 131 | - { name: "停车场2", method: this.clickActionCarNum }, | |
| 132 | - { name: "停车场3", method: this.clickActionCarNum }, | |
| 133 | - { name: "停车场4", method: this.clickActionCarNum }, | |
| 134 | - { name: "停车场5", method: this.clickActionCarNum } | |
| 193 | + { name: "前往绑定车牌", method: this.addCar } | |
| 135 | 194 | ], |
| 136 | - carNumber: "京A12334", | |
| 195 | + carNumber: "请选择车牌", | |
| 137 | 196 | carNumberVisible: false, |
| 138 | 197 | parkMoreVisible: false, |
| 139 | - cardNum: 1, | |
| 140 | - unitPrice: 10, | |
| 141 | - needPay: 0 | |
| 198 | + cardNum: 1, // 卡数量 | |
| 199 | + unitPrice: 10, // 单价 | |
| 200 | + disPrice: 9, // 优惠金额 | |
| 201 | + needPay: 1, // 应付 | |
| 202 | + agreement: false, | |
| 203 | + typeNum: 1, // 卡类型判断 | |
| 204 | + showHideOnBlur: false, // 购买协议 | |
| 205 | + createVipCardOrder: {}, // 创建订单对象 | |
| 206 | + orderId: "" // 订单号 | |
| 142 | 207 | }; |
| 143 | 208 | }, |
| 209 | + mounted() { | |
| 210 | + this.queryParkListForVipCard(); // 获取停车场 | |
| 211 | + this.queryUserCars(); // 获取用户车牌 | |
| 212 | + }, | |
| 213 | + computed: { | |
| 214 | + // 卡类型 1-年卡;2-半年卡;3-季卡;4-月卡;5-日卡; | |
| 215 | + endTimeFunc() { | |
| 216 | + if (this.startData) { | |
| 217 | + switch (this.typeNum) { | |
| 218 | + case 1: | |
| 219 | + this.endDate = this.$moment(this.startData).add(12, "month").format("YYYY-MM-DD"); | |
| 220 | + return this.$moment(this.startData).add(12, "month").format("YYYY-MM-DD"); | |
| 221 | + break; | |
| 222 | + case 2: | |
| 223 | + this.endDate = this.$moment(this.startData).add(6, "month").format("YYYY-MM-DD"); | |
| 224 | + return this.$moment(this.startData).add(6, "month").format("YYYY-MM-DD"); | |
| 225 | + break; | |
| 226 | + case 3: | |
| 227 | + this.endDate = this.$moment(this.startData).add(3, "month").format("YYYY-MM-DD"); | |
| 228 | + return this.$moment(this.startData).add(3, "month").format("YYYY-MM-DD"); | |
| 229 | + break; | |
| 230 | + case 4: | |
| 231 | + this.endDate = this.$moment(this.startData).add(1, "month").format("YYYY-MM-DD"); | |
| 232 | + return this.$moment(this.startData).add(1, "month").format("YYYY-MM-DD"); | |
| 233 | + break; | |
| 234 | + case 5: | |
| 235 | + this.endDate = this.$moment(this.startData).add(1, "days").format("YYYY-MM-DD"); | |
| 236 | + return this.$moment(this.startData).add(1, "days").format("YYYY-MM-DD"); | |
| 237 | + break; | |
| 238 | + } | |
| 239 | + // return this.$moment(this.startData).add(1,"month").format("YYYY-MM-DD"); | |
| 240 | + // return this.startData.getMonth()+1 | |
| 241 | + } | |
| 242 | + // switch (val){ | |
| 243 | + // case 2: | |
| 244 | + // return this.startData.setMonth(this.startData.getMonth()+1); | |
| 245 | + // break; | |
| 246 | + // } | |
| 247 | + } | |
| 248 | + }, | |
| 144 | 249 | methods: { |
| 145 | - //打开时间选择器 | |
| 250 | + // 获取用户绑定车牌 | |
| 251 | + queryUserCars() { | |
| 252 | + let jsondata = this.$utils.commonParams(); | |
| 253 | + jsondata.sign = this.$utils.signObject(jsondata); | |
| 254 | + queryUserCars(jsondata).then(data => { | |
| 255 | + console.log(data); | |
| 256 | + let res = data.data; | |
| 257 | + if (data.code == 0) { | |
| 258 | + if (res.length > 0) { | |
| 259 | + if (res.length == 3) { | |
| 260 | + this.carNumList = []; | |
| 261 | + } | |
| 262 | + res.forEach((item, index) => { | |
| 263 | + this.carNumList.unshift({ | |
| 264 | + name: item.carNumber, | |
| 265 | + method: this.bandingCar | |
| 266 | + }); | |
| 267 | + }); | |
| 268 | + } | |
| 269 | + console.log(this.carNumList); | |
| 270 | + } else { | |
| 271 | + this.$vux.toast.text(data.message, "top"); | |
| 272 | + } | |
| 273 | + }); | |
| 274 | + }, | |
| 275 | + // 打开时间选择器 | |
| 146 | 276 | selectData() { |
| 277 | + // this.dateVal = this.startData | |
| 147 | 278 | this.$refs["datePicker"].open(); |
| 148 | 279 | // console.log(this.startData) |
| 149 | 280 | // this.endDate = this.startData.setMonth(this.startData.getMonth()+1) |
| 150 | 281 | // console.log(this.endDate) |
| 151 | 282 | }, |
| 283 | + // | |
| 284 | + queryParkListForVipCard() { | |
| 285 | + let jsondata = this.$utils.commonParams(); | |
| 286 | + jsondata.parkName = ""; //搜索的停车场名称 | |
| 287 | + jsondata.sign = this.$utils.signObject(jsondata); | |
| 288 | + queryParkListForVipCard(jsondata).then(data => { | |
| 289 | + console.log(data); | |
| 290 | + if (data.code == 0) { | |
| 291 | + let res = data.data; | |
| 292 | + res.parkList.forEach((item, i) => { | |
| 293 | + this.parkNameList.push({ | |
| 294 | + name: item.plName, | |
| 295 | + parkNo: item.plNo, | |
| 296 | + method: this.parkNameAction | |
| 297 | + }); | |
| 298 | + }); | |
| 299 | + } else { | |
| 300 | + this.$vux.toast.text(data.message, "top"); | |
| 301 | + } | |
| 302 | + }); | |
| 303 | + }, | |
| 152 | 304 | handleConfirm() { |
| 153 | 305 | console.log(this.dateVal); |
| 154 | 306 | this.startData = this.$utils.timestampToTime(this.dateVal); |
| 155 | - this.endDate = this.dateVal.setMonth(this.dateVal.getMonth() + 1); | |
| 307 | + // this.endDate = this.dateVal.setMonth(this.dateVal.getMonth() + 1); | |
| 308 | + }, | |
| 309 | + // 停车场选择事件 | |
| 310 | + parkNameAction(e) { | |
| 311 | + console.log(e); | |
| 312 | + this.parkName = e.name; | |
| 313 | + this.parkNo = e.parkNo; | |
| 314 | + // alert(this.parkNo) | |
| 315 | + this.queryVipCardInfoByPlNo(); | |
| 156 | 316 | }, |
| 157 | - clickAction(e) { | |
| 158 | - console.log(e.name); | |
| 317 | + // 根据停车场搜卡类型 | |
| 318 | + queryVipCardInfoByPlNo() { | |
| 319 | + let me = this; | |
| 320 | + let jsondata = this.$utils.commonParams(); | |
| 321 | + jsondata.plNo = this.parkNo; | |
| 322 | + jsondata.plNo = this.parkNo; | |
| 323 | + jsondata.sign = this.$utils.signObject(jsondata); | |
| 324 | + queryVipCardInfoByPlNo(jsondata).then(data => { | |
| 325 | + console.log(data); | |
| 326 | + if (data.code == 0) { | |
| 327 | + // res.vipCardList = | |
| 328 | + // this.cardTypeList = res.vipCardList | |
| 329 | + // { name: "月卡", num: 1, method: this.clickAction }, | |
| 330 | + let vipCardList = data.data.vipCardList; | |
| 331 | + vipCardList.forEach((item, index) => { | |
| 332 | + me.$set(item, "name", item.cardName); | |
| 333 | + me.$set(item, "method", me.vipCardAction); | |
| 334 | + me.cardTypeList.push(item); | |
| 335 | + }); | |
| 336 | + console.log(me.cardTypeList); | |
| 337 | + } else { | |
| 338 | + this.$vux.toast.text(data.message, "top"); | |
| 339 | + } | |
| 340 | + }); | |
| 341 | + }, | |
| 342 | + bandingCar(e) { | |
| 343 | + this.carNumber = e.name; | |
| 344 | + }, | |
| 345 | + addCar(e) { | |
| 346 | + this.$router.push({ | |
| 347 | + path: "addCar", | |
| 348 | + query: { | |
| 349 | + source: 1 // 1表示来源是购买车牌页面 | |
| 350 | + } | |
| 351 | + }); | |
| 352 | + }, | |
| 353 | + vipCardAction(e) { | |
| 354 | + console.log(e); | |
| 159 | 355 | this.carType = e.name; |
| 160 | - this.endDate = this.startData; | |
| 356 | + // this.startData = e.expDate; | |
| 357 | + // this.endDate = e.effDate; | |
| 358 | + // this.cardNum = e.validNum; | |
| 359 | + this.unitPrice = e.price; | |
| 360 | + this.disPrice = e.price * ((10 - e.discValue) / 10); | |
| 361 | + this.needPay = this.unitPrice - this.disPrice; | |
| 362 | + this.startData = new Date(); | |
| 363 | + this.typeNum = e.cardType; | |
| 364 | + this.createVipCardOrder = e; | |
| 365 | + // this.endDate = this.endTimeFunc(e.carType); | |
| 366 | + // this.endDate = this.startData; | |
| 367 | + // 卡类型 1-年卡;2-半年卡;3-季卡;4-月卡;5-日卡; | |
| 161 | 368 | }, |
| 162 | 369 | clickActionCarNum(e) { |
| 163 | 370 | this.carNumber = e.name; |
| 164 | 371 | }, |
| 165 | 372 | addCardNum() { // 增加购买数量 |
| 166 | 373 | this.cardNum++; |
| 167 | - this.calcMoney() | |
| 374 | + this.calcMoney(); | |
| 168 | 375 | }, |
| 169 | 376 | reduceCarNum() { // 增加购买数量 |
| 170 | 377 | if (this.cardNum == 1) { |
| 171 | 378 | return; |
| 172 | 379 | } |
| 173 | 380 | this.cardNum--; |
| 174 | - this.calcMoney() | |
| 381 | + this.calcMoney(); | |
| 175 | 382 | }, |
| 176 | 383 | calcMoney() { |
| 177 | - this.needPay = this.cardNum*this.unitPrice | |
| 384 | + this.needPay = this.cardNum * (this.unitPrice - this.disPrice); | |
| 385 | + }, | |
| 386 | + // 购买 | |
| 387 | + toPay() { | |
| 388 | + if (this.parkName == "请点击选择") { | |
| 389 | + this.$vux.toast.text("请选择停车场", "top"); | |
| 390 | + return; | |
| 391 | + } | |
| 392 | + if (this.carType == "请点击选择") { | |
| 393 | + this.$vux.toast.text("请选择卡类型", "top"); | |
| 394 | + return; | |
| 395 | + } | |
| 396 | + if (this.carNumber == "请选择车牌") { | |
| 397 | + this.$vux.toast.text("请选择车牌", "top"); | |
| 398 | + return; | |
| 399 | + } | |
| 400 | + if (!this.agreement) { | |
| 401 | + this.$vux.toast.text("请同意购买须知", "top"); | |
| 402 | + return; | |
| 403 | + } | |
| 404 | + this.createOrder(); | |
| 405 | + }, | |
| 406 | + createOrder() { | |
| 407 | + console.log(this.createVipCardOrder); | |
| 408 | + let me = this; | |
| 409 | + let jsondata = this.$utils.commonParams(); | |
| 410 | + jsondata.plNo = this.parkNo; // 停车场id | |
| 411 | + jsondata.cardNo = this.createVipCardOrder.cardNo; // 卡券编码 | |
| 412 | + jsondata.cardType = (this.createVipCardOrder.cardType).toString(); // 卡类型 | |
| 413 | + jsondata.carType = (this.createVipCardOrder.carType).toString(); // 1-大型车;2-小型车 | |
| 414 | + // jsondata.plNo = this.createVipCardOrder.id; // 1-大型车;2-小型车 | |
| 415 | + jsondata.price = (this.createVipCardOrder.price).toString(); // 卡单价 | |
| 416 | + jsondata.totalAmount = (this.needPay).toString(); // 购买的总金额 | |
| 417 | + jsondata.num = this.cardNum; // 购买数量 | |
| 418 | + jsondata.effDate = this.$utils.timestampToTime(this.startData); // 生效时间 | |
| 419 | + jsondata.expDate = this.$utils.timestampToTime(this.endDate); // 失效时间 | |
| 420 | + jsondata.carNumber = this.carNumber; // 卡适用车牌 | |
| 421 | + jsondata.optType = "1"; // 操作类型 1 购买 2 续费 | |
| 422 | + jsondata.forceBuy = "1"; | |
| 423 | + jsondata.sign = this.$utils.signObject(jsondata); | |
| 424 | + createVipCardOrder(jsondata).then(data => { | |
| 425 | + console.log(data); | |
| 426 | + // orderId | |
| 427 | + if (data.code == 0) { | |
| 428 | + this.orderId = data.data.orderId; | |
| 429 | + this.vxPay(); | |
| 430 | + } else { | |
| 431 | + this.$vux.toast.text(data.message, "top"); | |
| 432 | + } | |
| 433 | + }); | |
| 434 | + }, | |
| 435 | + vxPay() { | |
| 436 | + let vm = this; | |
| 437 | + let jsondata = this.$utils.commonParams(); | |
| 438 | + jsondata.orderId = this.orderId; // 订单号 | |
| 439 | + jsondata.payType = "4"; // 支付方式-- 1:支付宝 2:微信 3:银联. | |
| 440 | + jsondata.paySrcType = "301"; // 支付单来源 101:停车付款单 102:停车预付单 103:停车补缴单 104 共享车位 201 余额充值单 202 押金充值单 301 会员卡购买单 302 会员卡续费 | |
| 441 | + jsondata.appId = this.$utils.myVxAppId; // 微信标识符 | |
| 442 | + jsondata.terminalSource = "3"; // 请求端来源 1: 任你停 2:pda 3:微信公共号 | |
| 443 | + jsondata.paySource = "3"; | |
| 444 | + jsondata.couponPersonId = ""; | |
| 445 | + jsondata.openId = sessionStorage.getItem("wx_openId"); | |
| 446 | + jsondata.sign = this.$utils.signObject(jsondata); | |
| 447 | + weixinpay(jsondata).then(res => { | |
| 448 | + console.log(data); | |
| 449 | + if (res.code == 0) { // | |
| 450 | + if (res.data) { | |
| 451 | + var data = res.data; | |
| 452 | + console.log(JSON.stringify(data)); | |
| 453 | + if (typeof WeixinJSBridge === "undefined") { // 微信浏览器内置对象。参考微信官方文档 | |
| 454 | + if (document.addEventListener) { | |
| 455 | + document.addEventListener("WeixinJSBridgeReady", vm.onBridgeReady(data), false); | |
| 456 | + } else if (document.attachEvent) { | |
| 457 | + document.attachEvent("WeixinJSBridgeReady", vm.onBridgeReady(data)); | |
| 458 | + document.attachEvent("onWeixinJSBridgeReady", vm.onBridgeReady(data)); | |
| 459 | + } | |
| 460 | + } else { | |
| 461 | + console.log("准备调用微信支付"); | |
| 462 | + vm.onBridgeReady(data); | |
| 463 | + } | |
| 464 | + } else { | |
| 465 | + alert("没有找到返回值"); | |
| 466 | + } | |
| 467 | + } else { | |
| 468 | + alert(res.message); | |
| 469 | + } | |
| 470 | + }); | |
| 471 | + }, | |
| 472 | + onBridgeReady(params) { | |
| 473 | + let me = this; | |
| 474 | + console.log("调用微信支付WeixinJSBridge"); | |
| 475 | + WeixinJSBridge.invoke( | |
| 476 | + "getBrandWCPayRequest", params, | |
| 477 | + // | |
| 478 | + // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 | |
| 479 | + // 'appId': data.appId, // 公众号名称,由商户传入 | |
| 480 | + // 'timeStamp': data.timeStamp, // 时间戳 | |
| 481 | + // 'nonceStr': data.nonceStr, // 随机串 | |
| 482 | + // 'package': data.package, // 预支付id | |
| 483 | + // 'signType': data.signType, // 微信签名方式 | |
| 484 | + // 'paySign': data.paySign // 微信签名 | |
| 485 | + // }, | |
| 486 | + function(res) { | |
| 487 | + // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | |
| 488 | + if (res.err_msg === "get_brand_wcpay_request:ok") { | |
| 489 | + console.log("成功"); | |
| 490 | + this.$vux.toast.text("支付成功", "top"); | |
| 491 | + me.$router.go(-2); | |
| 492 | + } else { | |
| 493 | + console.log("失败"); | |
| 494 | + alert("支付失败"); | |
| 495 | + me.$router.go(-2); | |
| 496 | + } | |
| 497 | + } | |
| 498 | + ); | |
| 178 | 499 | } |
| 179 | 500 | }, |
| 180 | 501 | filters: { |
| ... | ... | @@ -266,7 +587,6 @@ export default { |
| 266 | 587 | } |
| 267 | 588 | |
| 268 | 589 | .park-list { |
| 269 | - | |
| 270 | 590 | /*width: 80%;*/ |
| 271 | 591 | li { |
| 272 | 592 | padding-left: 20px; |
| ... | ... | @@ -274,4 +594,23 @@ export default { |
| 274 | 594 | } |
| 275 | 595 | } |
| 276 | 596 | |
| 597 | + .agreen-box { | |
| 598 | + padding: 15px; | |
| 599 | + text-align: left; | |
| 600 | + p { | |
| 601 | + margin-bottom: 15px; | |
| 602 | + } | |
| 603 | + } | |
| 604 | + | |
| 605 | + .vux-close { | |
| 606 | + margin-top: 8px; | |
| 607 | + margin-bottom: 8px; | |
| 608 | + font-size: 18px; | |
| 609 | + } | |
| 610 | + | |
| 611 | + /deep/ .picker-items { | |
| 612 | + width: 100% | |
| 613 | + } | |
| 614 | + | |
| 615 | + | |
| 277 | 616 | </style> | ... | ... |
src/views/mySelf/selfNav.vue
| ... | ... | @@ -40,13 +40,13 @@ export default { |
| 40 | 40 | data() { |
| 41 | 41 | return { |
| 42 | 42 | menuList: [ |
| 43 | - { name: "会员卡", path: "" }, | |
| 44 | - { name: "车辆管理", path: "" }, | |
| 43 | + { name: "会员卡", path: "Cards" }, | |
| 44 | + { name: "车辆管理", path: "myCars" }, | |
| 45 | 45 | { name: "发票管理", path: "eInvoiceWrap" }, |
| 46 | 46 | { name: "停车记录", path: "parkNotes" }, |
| 47 | 47 | { name: "建议反馈", path: "suggestionBack" } |
| 48 | 48 | ], |
| 49 | - webAppCode: "", | |
| 49 | + webAppCode: "", // 071hQo0w34xoYX21CP2w3RRw7U1hQo02 | |
| 50 | 50 | couponNum: 0, // 卡券数量 |
| 51 | 51 | acctBalance: 0, // 账户余额 |
| 52 | 52 | userPhone: "--",// 账户手机号 |
| ... | ... | @@ -57,9 +57,9 @@ export default { |
| 57 | 57 | }; |
| 58 | 58 | }, |
| 59 | 59 | created() { |
| 60 | - this.$vux.loading.show({ | |
| 61 | - text: "数据加载中..." | |
| 62 | - }); | |
| 60 | + // this.$vux.loading.show({ | |
| 61 | + // text: "数据加载中..." | |
| 62 | + // }); | |
| 63 | 63 | if (this.$utils.clientBrowser() == "微信") { |
| 64 | 64 | this.webAppCode = this.getCode(); |
| 65 | 65 | } |
| ... | ... | @@ -68,7 +68,7 @@ export default { |
| 68 | 68 | let that = this; |
| 69 | 69 | if(sessionStorage.getItem("wx_openId")){ |
| 70 | 70 | this.getTokenByOpenId(sessionStorage.getItem("wx_openId")); |
| 71 | - // this.getinfoself() | |
| 71 | + this.getinfoself() | |
| 72 | 72 | }else{ |
| 73 | 73 | if (this.webAppCode) { |
| 74 | 74 | this.getopenid(); |
| ... | ... | @@ -126,6 +126,7 @@ export default { |
| 126 | 126 | let _token = data.data.token; |
| 127 | 127 | console.log('getTokenByOpenId获取到的'+_token) |
| 128 | 128 | sessionStorage.setItem("wx_Token", data.data.token); |
| 129 | + // alert(data.data.token) | |
| 129 | 130 | sessionStorage.setItem("WXPhone", data.data.phoneNum); |
| 130 | 131 | that.getinfoself(); //获取用户信息 |
| 131 | 132 | } else { |
| ... | ... | @@ -231,6 +232,9 @@ export default { |
| 231 | 232 | }); |
| 232 | 233 | } else { |
| 233 | 234 | this.$vux.toast.text("请先绑定手机号", "top"); |
| 235 | + this.$router.push({ | |
| 236 | + path: "binDing" | |
| 237 | + }); | |
| 234 | 238 | } |
| 235 | 239 | } |
| 236 | 240 | } | ... | ... |