Commit 93c5ecb3ad73effc67ca9da68bb3726e1cb81604
1 parent
9ea66a4e
add 添加filter.js 设置;关于我们;清除缓存;退出登录等功能页面 接口联调
Showing
8 changed files
with
223 additions
and
755 deletions
common/common.js
| ... | ... | @@ -28,6 +28,9 @@ const userLoginout = serverUrl + "/business/h5/index/logout"; |
| 28 | 28 | // 商户关于我们 |
| 29 | 29 | const useraboutUs = serverUrl + "/business/h5/index/aboutUs"; |
| 30 | 30 | |
| 31 | +// 商户账户余额信息 | |
| 32 | +const walletAccount = serverUrl + "/business/h5/wallet/account"; | |
| 33 | + | |
| 31 | 34 | // |
| 32 | 35 | const requestSign = function(inputData) { |
| 33 | 36 | |
| ... | ... | @@ -122,4 +125,5 @@ export default { |
| 122 | 125 | indexInfo, |
| 123 | 126 | userLoginout, |
| 124 | 127 | useraboutUs, |
| 128 | + walletAccount, | |
| 125 | 129 | } | ... | ... |
common/requestServer.js
| 1 | 1 | import common from "./common.js"; |
| 2 | 2 | export const myRequest = (options) => { |
| 3 | - // 调接口加载 | |
| 4 | - uni.showLoading({ | |
| 5 | - title: "加载中", | |
| 6 | - mask: true, | |
| 7 | - }); | |
| 8 | - return new Promise((resolve, reject) => { | |
| 9 | - uni.request({ | |
| 10 | - url: options.url, | |
| 11 | - //默认参数 | |
| 12 | - data: options.data || {}, | |
| 13 | - // 配置请求头参数-例如token | |
| 14 | - header: { | |
| 15 | - 'content-type': 'application/json', | |
| 16 | - // Accept: 'application/json', | |
| 17 | - // 'Content-Type': 'application/json', | |
| 18 | - // 'X-Requested-With': 'XMLHttpRequest' | |
| 19 | - }, | |
| 20 | - dataType: "json", | |
| 21 | - method: options.method || 'GET', | |
| 22 | - // sslVerify: true, | |
| 23 | - // 接口请求成功 | |
| 24 | - success: (res) => { | |
| 25 | - // 关闭加载 | |
| 26 | - uni.hideLoading(); | |
| 27 | - // 调用成功且有数据 返回数据 组件内通过 .then() 或者async await 接受异步返回数据 | |
| 28 | - //resolve(res.data) | |
| 29 | - //在接口200 调用成功后 才能进行判断接口内的状态码 return_code 以此判定作何操作和提示 | |
| 30 | - let result = res.data | |
| 31 | - console.log(result); | |
| 32 | - | |
| 33 | - if (result.code == 0) { | |
| 34 | - resolve(res.data) | |
| 35 | - } else { | |
| 36 | - uni.hideLoading(); | |
| 37 | - uni.showToast({ | |
| 38 | - title: result.message, | |
| 39 | - icon: 'error', | |
| 40 | - duration: 2000 | |
| 41 | - }); | |
| 42 | - } | |
| 43 | - | |
| 44 | - }, | |
| 45 | - // 接口接口失败 | |
| 46 | - fail: (error) => { | |
| 47 | - // 关闭加载 | |
| 48 | - uni.hideLoading(); | |
| 49 | - console.log("请求失败", error); | |
| 50 | - uni.showToast({ | |
| 51 | - title: error.message, | |
| 52 | - icon: 'error', | |
| 53 | - duration: 2000 | |
| 54 | - }) | |
| 55 | - // 失败数据 | |
| 56 | - reject(error) | |
| 57 | - } | |
| 58 | - }) | |
| 59 | - }) | |
| 60 | -} | |
| 61 | 3 | \ No newline at end of file |
| 4 | + // 调接口加载 | |
| 5 | + uni.showLoading({ | |
| 6 | + title: "加载中", | |
| 7 | + mask: true, | |
| 8 | + }); | |
| 9 | + return new Promise((resolve, reject) => { | |
| 10 | + uni.request({ | |
| 11 | + url: options.url, | |
| 12 | + //默认参数 | |
| 13 | + data: options.data || {}, | |
| 14 | + // 配置请求头参数-例如token | |
| 15 | + header: { | |
| 16 | + 'content-type': 'application/json', | |
| 17 | + // Accept: 'application/json', | |
| 18 | + // 'Content-Type': 'application/json', | |
| 19 | + // 'X-Requested-With': 'XMLHttpRequest' | |
| 20 | + }, | |
| 21 | + dataType: "json", | |
| 22 | + method: options.method || 'GET', | |
| 23 | + // sslVerify: true, | |
| 24 | + // 接口请求成功 | |
| 25 | + success: (res) => { | |
| 26 | + // 关闭加载 | |
| 27 | + uni.hideLoading(); | |
| 28 | + // 调用成功且有数据 返回数据 组件内通过 .then() 或者async await 接受异步返回数据 | |
| 29 | + //resolve(res.data) | |
| 30 | + //在接口200 调用成功后 才能进行判断接口内的状态码 return_code 以此判定作何操作和提示 | |
| 31 | + let result = res.data | |
| 32 | + console.log(result); | |
| 33 | + | |
| 34 | + if (result.code == 0) { | |
| 35 | + resolve(result) | |
| 36 | + } else if (result.code == -10000) { | |
| 37 | + uni.showModal({ | |
| 38 | + title: '提示', | |
| 39 | + content: result.message, | |
| 40 | + showCancel: false, | |
| 41 | + success: function(res) { | |
| 42 | + if (res.confirm) { | |
| 43 | + console.log('登录失效'); | |
| 44 | + uni.clearStorageSync(); | |
| 45 | + uni.reLaunch({ | |
| 46 | + url: "../pages/index/index" | |
| 47 | + }) | |
| 48 | + uni.hideLoading(); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + }); | |
| 52 | + } else { | |
| 53 | + uni.hideLoading(); | |
| 54 | + uni.showToast({ | |
| 55 | + title: result.message, | |
| 56 | + icon: 'error', | |
| 57 | + duration: 2000 | |
| 58 | + }); | |
| 59 | + } | |
| 60 | + | |
| 61 | + }, | |
| 62 | + // 接口接口失败 | |
| 63 | + fail: (error) => { | |
| 64 | + // 关闭加载 | |
| 65 | + uni.hideLoading(); | |
| 66 | + console.log("请求失败", error); | |
| 67 | + uni.showToast({ | |
| 68 | + title: error.message, | |
| 69 | + icon: 'error', | |
| 70 | + duration: 2000 | |
| 71 | + }) | |
| 72 | + // 失败数据 | |
| 73 | + reject(error) | |
| 74 | + } | |
| 75 | + }) | |
| 76 | + }) | |
| 77 | +} | ... | ... |
main.js
| 1 | 1 | import App from './App' |
| 2 | 2 | import store from './store' |
| 3 | -import common from "./common/common.js"; | |
| 4 | 3 | // 引入封装的接口api |
| 4 | +import common from "./common/common.js"; | |
| 5 | 5 | import { myRequest } from './common/requestServer.js' |
| 6 | +//引入封装的过滤器 filters | |
| 7 | +import * as filters from './common/filters.js' | |
| 6 | 8 | // 挂在Vue属性 全局通过this.$myRequest()可以访问到 |
| 7 | 9 | Vue.prototype.$common = common |
| 8 | 10 | Vue.prototype.$myRequest = myRequest |
| 9 | 11 | |
| 12 | +// 添加全局filter | |
| 13 | +Object.keys(filters).map(v => { | |
| 14 | + Vue.filter(v, filters[v]) | |
| 15 | +}) | |
| 16 | + | |
| 10 | 17 | // #ifndef VUE3 |
| 11 | 18 | import Vue from 'vue' |
| 12 | 19 | Vue.config.productionTip = false | ... | ... |
pages.json
pages/aboutOur/aboutOur.vue
| ... | ... | @@ -11,15 +11,15 @@ |
| 11 | 11 | <uni-list class=""> |
| 12 | 12 | <view class="recordCon uni-list-cell-pd"> |
| 13 | 13 | <text class="fontColor000">微信公众号</text> |
| 14 | - <text>江阴慧停车</text> | |
| 14 | + <text>{{officialAccountName}}</text> | |
| 15 | 15 | </view> |
| 16 | - <view class="recordCon uni-list-cell-pd"> | |
| 16 | + <view class="recordCon uni-list-cell-pd" @click="call"> | |
| 17 | 17 | <text class="fontColor000">客服电话</text> |
| 18 | - <text>400900800</text> | |
| 18 | + <text>{{customerServicePhone}}</text> | |
| 19 | 19 | </view> |
| 20 | 20 | <view class="recordCon uni-list-cell-pd"> |
| 21 | 21 | <text class="fontColor000">门户网站</text> |
| 22 | - <text>暂无</text> | |
| 22 | + <text>{{website}}</text> | |
| 23 | 23 | </view> |
| 24 | 24 | </uni-list> |
| 25 | 25 | |
| ... | ... | @@ -42,9 +42,36 @@ |
| 42 | 42 | return { |
| 43 | 43 | appName: '江阴慧停车', |
| 44 | 44 | apptitle: '江阴慧停车·智慧便捷', |
| 45 | + officialAccountName: '', | |
| 46 | + customerServicePhone: '', | |
| 47 | + website: '', | |
| 45 | 48 | } |
| 46 | 49 | }, |
| 50 | + mounted() { | |
| 51 | + this.aboutUs() | |
| 52 | + }, | |
| 47 | 53 | methods: { |
| 54 | + call(){ | |
| 55 | + var me = this; | |
| 56 | + uni.makePhoneCall({ | |
| 57 | + phoneNumber: me.customerServicePhone | |
| 58 | + }); | |
| 59 | + }, | |
| 60 | + aboutUs() { | |
| 61 | + let that = this; | |
| 62 | + that.$myRequest({ | |
| 63 | + url: that.$common.useraboutUs, | |
| 64 | + method: 'POST', | |
| 65 | + data: that.$common.requestSign() | |
| 66 | + }).then(res => { | |
| 67 | + | |
| 68 | + console.log(res) | |
| 69 | + let aboutInfo = res.data; | |
| 70 | + that.officialAccountName = aboutInfo.officialAccountName; | |
| 71 | + that.customerServicePhone = aboutInfo.customerServicePhone; | |
| 72 | + that.website = aboutInfo.website; | |
| 73 | + }) | |
| 74 | + }, | |
| 48 | 75 | |
| 49 | 76 | } |
| 50 | 77 | } | ... | ... |
pages/index/index.vue
| ... | ... | @@ -54,7 +54,7 @@ |
| 54 | 54 | </view> |
| 55 | 55 | <view class="index-title">停车记录</view> |
| 56 | 56 | </view> |
| 57 | - <view class="flex-item"> | |
| 57 | + <view class="flex-item" @click="toPursePage"> | |
| 58 | 58 | <view class=""> |
| 59 | 59 | <image src="../../static/me/me-balance.png" class="index-icon"></image> |
| 60 | 60 | </view> |
| ... | ... | @@ -175,6 +175,12 @@ |
| 175 | 175 | |
| 176 | 176 | }); |
| 177 | 177 | }, |
| 178 | + toPursePage() { | |
| 179 | + uni.navigateTo({ | |
| 180 | + url: '../moneyRecharge/moneyRecharge' | |
| 181 | + | |
| 182 | + }); | |
| 183 | + }, | |
| 178 | 184 | toInvoicePage() { |
| 179 | 185 | uni.navigateTo({ |
| 180 | 186 | url: '../invoiceClaim/invoiceClaim' |
| ... | ... | @@ -187,6 +193,7 @@ |
| 187 | 193 | |
| 188 | 194 | }); |
| 189 | 195 | }, |
| 196 | + | |
| 190 | 197 | } |
| 191 | 198 | } |
| 192 | 199 | </script> | ... | ... |
pages/moneyRecharge/moneyRecharge.vue
| 1 | 1 | <template> |
| 2 | 2 | <view> |
| 3 | - <!--<view class="order-title">--> | |
| 4 | - <!--订单详情--> | |
| 5 | - <!--</view>--> | |
| 3 | + | |
| 6 | 4 | <view class="rechargeTop"> |
| 7 | - <view class="toDetail uni-list-cell-pd uni-right">明细 ></view> | |
| 8 | - <view class="rechargeNum uni-center">¥17.34</view> | |
| 5 | + <view class="toDetail uni-list-cell-pd uni-right" @click="detailCell">明细 ></view> | |
| 6 | + <view class="rechargeNum uni-center">¥{{acctBalance}}</view> | |
| 9 | 7 | </view> |
| 10 | - | |
| 11 | - | |
| 12 | - | |
| 8 | + | |
| 13 | 9 | <uni-section title="充值金额" type="line" padding> |
| 14 | 10 | <uni-grid :column="3" :highlight="true" :showBorder="false" :square="false" @change="change"> |
| 15 | - <uni-grid-item v-for="(item, index) in ListData" :index="index" :key="index" | |
| 16 | - > | |
| 11 | + <uni-grid-item v-for="(item, index) in ListData" :index="index" :key="index"> | |
| 17 | 12 | <view class="grid-item-box" style="background-color: #fff;"> |
| 18 | 13 | <view class="text" :class="currentIndex==index?'itemActive':''">{{item.text}}</view> |
| 19 | 14 | </view> |
| ... | ... | @@ -26,30 +21,21 @@ |
| 26 | 21 | </view> |
| 27 | 22 | <view class="border-bg"></view> |
| 28 | 23 | |
| 29 | - | |
| 30 | - <!--<view class="order-line-bold"></view>--> | |
| 31 | 24 | <view class="order-title"> |
| 32 | 25 | 支付方法 |
| 33 | 26 | </view> |
| 34 | 27 | <view class="order-line"></view> |
| 35 | 28 | |
| 36 | - <view class="orderwaysview" @click="selPaywaysClick(0)"> | |
| 29 | + <view class="orderwaysview"> | |
| 37 | 30 | <image src="../../static/orderInfo/orderinfo-wechat.png" class="orderways"></image> |
| 38 | 31 | <view class="order-info" style="margin-left: 8px;"> |
| 39 | 32 | 微信支付 |
| 40 | 33 | </view> |
| 41 | - | |
| 42 | - <image v-show="payWaysSel != 0" src="../../static/orderInfo/orderinfo-unsel.png" | |
| 43 | - class="orderwaysSel"></image> | |
| 44 | - <image v-show="payWaysSel == 0" src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image> | |
| 45 | - | |
| 46 | - | |
| 34 | + <image src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image> | |
| 47 | 35 | </view> |
| 48 | 36 | |
| 49 | 37 | <button @click="payClick" class="button-sp-area" type="primary" plain="true">确认充值</button> |
| 50 | - <view v-show="alertFlag"> | |
| 51 | - <div class="alertFlag">请先登录</div> | |
| 52 | - </view> | |
| 38 | + | |
| 53 | 39 | </view> |
| 54 | 40 | </template> |
| 55 | 41 | |
| ... | ... | @@ -58,6 +44,7 @@ import common from "../../common/common.js"; |
| 58 | 44 | export default { |
| 59 | 45 | data() { |
| 60 | 46 | return { |
| 47 | + acctBalance:'0.00', | |
| 61 | 48 | ListData: [ |
| 62 | 49 | { |
| 63 | 50 | text: '100元' |
| ... | ... | @@ -79,636 +66,43 @@ export default { |
| 79 | 66 | }, |
| 80 | 67 | ], |
| 81 | 68 | currentIndex: 0, |
| 82 | - mycarNumber: '', | |
| 83 | - myorderId: '', | |
| 84 | - myparkCode: '', | |
| 85 | - myorderinfo1: {}, | |
| 86 | - myorderinfo: {}, | |
| 87 | - payWaysSel: 0, | |
| 88 | - myorderState: 0, | |
| 89 | - mypaySrcType: '', | |
| 90 | - selCoupon: {}, | |
| 91 | - appOrderTimeout: '', | |
| 92 | - loginflag: 0, | |
| 93 | - phoneNumb: '', | |
| 94 | - totalFee: '', //应收 | |
| 95 | - alertFlag: false, | |
| 96 | - unPayFee: '' //实收 | |
| 69 | + | |
| 97 | 70 | } |
| 98 | 71 | }, |
| 99 | - onLoad(params) { | |
| 100 | - wx.showShareMenu({ | |
| 101 | - withShareTicket: true | |
| 102 | - }) | |
| 103 | - this.mycarNumber = params.carNumber; | |
| 104 | - this.myorderId = params.orderId; | |
| 105 | - this.myparkCode = params.parkCode; | |
| 106 | - this.myorderState = params.orderState; | |
| 107 | - this.totalFee = params.totalFee | |
| 108 | - this.unPayFee = params.unPayFee | |
| 109 | - if (params.orderState == 5) { | |
| 110 | - //停车补缴单 103 | |
| 111 | - this.mypaySrcType = '103' | |
| 112 | - } else { | |
| 113 | - this.mypaySrcType = '101' | |
| 114 | - } | |
| 115 | - // this.GetbillQueryInfo(this.mycarNumber, this.myorderId, this.myparkCode); | |
| 116 | - this.getWxCode(); | |
| 117 | - this.PDlogin(); | |
| 118 | - //console.log("xxxmake = "+this.makedateFormat()); | |
| 72 | + onLoad() { | |
| 73 | + | |
| 119 | 74 | }, |
| 120 | - onShow() { | |
| 121 | - var me = this; | |
| 122 | - var userInfo = me.getGlobalUser("globalUser"); | |
| 123 | - if (userInfo != null) { | |
| 124 | - me.phoneNumb = userInfo.userPhone; | |
| 125 | - } | |
| 126 | - var pages = getCurrentPages(); | |
| 127 | - var currPage = pages[pages.length - 1]; //当前页面 | |
| 128 | - console.log('currPage.data.selCoupon = ' + currPage.data.selCoupon); | |
| 129 | - me.selCoupon = currPage.data.selCoupon; | |
| 130 | - console.log(JSON.stringify(me.selCoupon)); | |
| 131 | - me.GetbillQueryInfo(me.mycarNumber, me.myorderId, me.myparkCode, me.selCoupon.cardNo, me.selCoupon.couponType, me.selCoupon | |
| 132 | - .discValue); | |
| 133 | - // GetbillQueryInfo(carnum, orderId, parkCode, cardNo, couponType, disValue) { | |
| 75 | + mounted() { | |
| 76 | + this.recharge() | |
| 134 | 77 | }, |
| 135 | 78 | methods: { |
| 79 | + recharge() { | |
| 80 | + let that = this; | |
| 81 | + that.$myRequest({ | |
| 82 | + url: that.$common.walletAccount, | |
| 83 | + method: 'POST', | |
| 84 | + data: that.$common.requestSign() | |
| 85 | + }).then(res => { | |
| 86 | + | |
| 87 | + console.log(res) | |
| 88 | + let data = res.data; | |
| 89 | + that.acctBalance = data.acctBalance; | |
| 90 | + | |
| 91 | + }) | |
| 92 | + }, | |
| 93 | + | |
| 136 | 94 | change(e) { |
| 137 | 95 | |
| 138 | 96 | let { |
| 139 | 97 | index |
| 140 | 98 | } = e.detail |
| 141 | - // this.list[index].badge && this.list[index].badge++ | |
| 99 | + | |
| 142 | 100 | this.currentIndex = index |
| 143 | - uni.showToast({ | |
| 144 | - title: `点击第${index + 1}个宫格`, | |
| 145 | - icon: 'none' | |
| 146 | - }) | |
| 147 | - }, | |
| 148 | - PDlogin() { | |
| 149 | - var me = this; | |
| 150 | - // var loginflag = 0; | |
| 151 | - var globalUser = me.getGlobalUser("globalUser"); | |
| 152 | - if (globalUser == undefined || globalUser == null || globalUser.token == null || globalUser.token == undefined || | |
| 153 | - globalUser.token.length == 0) { | |
| 154 | - me.loginflag = 0; | |
| 155 | - } else { | |
| 156 | - me.loginflag = 1; | |
| 157 | - } | |
| 158 | - }, | |
| 159 | - //选择优惠券 | |
| 160 | - DiscountClick() { | |
| 161 | - console.log("gotoDiscountView"); | |
| 162 | - var me = this; | |
| 163 | - if (me.loginflag == 0) { | |
| 164 | - uni.showToast({ | |
| 165 | - title: '请先登录', | |
| 166 | - icon: 'none', | |
| 167 | - duration: 4000 | |
| 168 | - }) | |
| 169 | - return; | |
| 170 | - } | |
| 171 | - var myurl = 'use_couponList/use_couponList?plNo=' + me.myparkCode + '&parkingDura=' + me.myorderinfo.staytime + | |
| 172 | - '&parkingFee=' + me.myorderinfo.orderTotalFee + '&carNumber=' + me.mycarNumber + '&carType=' + me.myorderinfo.carType; | |
| 173 | - uni.navigateTo({ | |
| 174 | - url: myurl | |
| 175 | - }); | |
| 176 | - }, | |
| 177 | - //选择支付方式 | |
| 178 | - selPaywaysClick(selNumb) { | |
| 179 | - let me = this | |
| 180 | - this.payWaysSel = selNumb; | |
| 181 | - console.log("this.payWaysSel: " + this.payWaysSel); | |
| 182 | - console.log(me.loginflag) | |
| 183 | - if (this.payWaysSel == 1) { | |
| 184 | - if (me.loginflag == 0) { | |
| 185 | - uni.showToast({ | |
| 186 | - title: '请先登录', | |
| 187 | - icon: 'none', | |
| 188 | - duration: 2000 | |
| 189 | - }) | |
| 190 | - return; | |
| 191 | - } | |
| 192 | - } | |
| 193 | - }, | |
| 194 | - payClick() { | |
| 195 | - var me = this; | |
| 196 | - me.goPay_billQueryInfo(me.mycarNumber, me.myorderId, me.myparkCode, me.selCoupon.cardNo, me.selCoupon.couponType, | |
| 197 | - me.selCoupon.discValue); | |
| 198 | - // if(me.myorderinfo.orderFee == 0){ | |
| 199 | - // uni.showModal({ | |
| 200 | - // title: '提示', | |
| 201 | - // content: '0元无需支付', | |
| 202 | - // showCancel: false, | |
| 203 | - // success: function(res) { | |
| 204 | - // if (res.confirm) { | |
| 205 | - // console.log('0元无需支付'); | |
| 206 | - // me.GetbillQueryInfo(me.mycarNumber, me.myorderId, me.myparkCode ,me.selCoupon.cardNo ,me.selCoupon.couponType ,me.selCoupon.discValue); | |
| 207 | - // } | |
| 208 | - // } | |
| 209 | - // }); | |
| 210 | - // return; | |
| 211 | - // } | |
| 212 | - // //用户选择微信支付 | |
| 213 | - // if (me.payWaysSel == 0) { | |
| 214 | - // me.getWxPayinfo(); | |
| 215 | - // } else { | |
| 216 | - // me.UseAccountPay(); | |
| 217 | - // } | |
| 218 | - }, | |
| 219 | - getWxPayinfo() { | |
| 220 | - var me = this; | |
| 221 | - uni.showLoading({ | |
| 222 | - mask: true, | |
| 223 | - title: "请稍后..." | |
| 224 | - }); | |
| 225 | - uni.showNavigationBarLoading(); | |
| 226 | - var getwxpayinfoUrl = common.getwxpayinfoUrl; | |
| 227 | - if (me.mypaySrcType == 101) { | |
| 228 | - me.payQuery(100) | |
| 229 | - } else { | |
| 230 | - me.rltOrderId() | |
| 231 | - } | |
| 232 | - }, | |
| 233 | - rltOrderId() { | |
| 234 | - var me = this; | |
| 235 | - console.log(me.totalFee) | |
| 236 | - console.log(me.unPayFee) | |
| 237 | - var jsondata = { | |
| 238 | - parkOrderIds: [me.myorderId], | |
| 239 | - orderBigType: 100, | |
| 240 | - payOrderType: 103, | |
| 241 | - terminalSource: 11, | |
| 242 | - operCode: me.phoneNumb,//订单生成操作人 如果是车主 传 custId | |
| 243 | - operName: me.phoneNumb,//订单生成操作人名称 如果是车主 传车主名称或手机号 | |
| 244 | - orgId: common.public_orgId, | |
| 245 | - orderActFee: me.myorderinfo.orderFee, | |
| 246 | - orderTotalFee: me.unPayFee, | |
| 247 | - }; | |
| 248 | - uni.request({ | |
| 249 | - url: common.doOrderCreate, | |
| 250 | - data: JSON.stringify(jsondata), | |
| 251 | - // url: getwxPayUnifiedorderUrl, | |
| 252 | - // data: JSON.stringify(common.requestSign(jsondata)), | |
| 253 | - dataType: "json", | |
| 254 | - method: "POST", | |
| 255 | - success: (res) => { | |
| 256 | - if (res.data.code == 0) { | |
| 257 | - console.log(res.data.data.rltOrderId); | |
| 258 | - me.myorderId = res.data.data.rltOrderId | |
| 259 | - console.log(me.myorderId) | |
| 260 | - me.payQuery(100) | |
| 261 | - // uni.hideNavigationBarLoading(); | |
| 262 | - // uni.hideLoading(); | |
| 263 | - } else { | |
| 264 | - uni.showModal({ | |
| 265 | - title: '提示', | |
| 266 | - content: res.data.message, | |
| 267 | - showCancel: false, | |
| 268 | - success: function (res) { | |
| 269 | - } | |
| 270 | - }); | |
| 271 | - // uni.showToast({ | |
| 272 | - // title: res.data.message, | |
| 273 | - // // icon: none; | |
| 274 | - // duration: 2000 | |
| 275 | - // }) | |
| 276 | - } | |
| 277 | - }, | |
| 278 | - complete: () => { | |
| 279 | - // uni.hideNavigationBarLoading(); | |
| 280 | - // uni.hideLoading(); | |
| 281 | - } | |
| 282 | - }); | |
| 283 | - }, | |
| 284 | - payQuery(_orderBigType) { | |
| 285 | - var me = this; | |
| 286 | - console.log(me.totalFee) | |
| 287 | - console.log(me.unPayFee) | |
| 288 | - console.log(me.mypaySrcType) | |
| 289 | - var jsondata = { | |
| 290 | - orderBigType: _orderBigType, | |
| 291 | - payOrderType: me.mypaySrcType, | |
| 292 | - rltOrderId: me.myorderId, | |
| 293 | - payType: 2, | |
| 294 | - terminalSource: 11, | |
| 295 | - orderActFee: me.myorderinfo.orderFee, | |
| 296 | - orderTotalFee: me.unPayFee, | |
| 297 | - // totalFee: '', //应收 | |
| 298 | - // unPayFee: '' //实收 | |
| 299 | - payUserId: me.getWxOpenid("WxOpenid"), | |
| 300 | - terminalOS: uni.getSystemInfoSync().platform == 'android' ? 'AND' : 'IOS', | |
| 301 | - //terminalOS:isAndroid?'AND':'IOS', | |
| 302 | - //uni.getSystemInfoSync().platform | |
| 303 | - }; | |
| 304 | - uni.request({ | |
| 305 | - //url: getwxpayinfoUrl, | |
| 306 | - url: common.doPayUrl, | |
| 307 | - data: JSON.stringify(jsondata), | |
| 308 | - //data: JSON.stringify(common.requestSign(jsondata)), | |
| 309 | - header: { | |
| 310 | - 'content-type': 'application/json' | |
| 311 | - }, | |
| 312 | - dataType: "json", | |
| 313 | - method: "POST", | |
| 314 | - success: (res) => { | |
| 315 | - console.log(res) | |
| 316 | - if (res.statusCode == 200) { | |
| 317 | - me.myorderinfo1 = res.data; | |
| 318 | - // var code = res.data.code; | |
| 319 | - console.log(JSON.stringify(res.data)); | |
| 320 | - // var mydata = res.data; | |
| 321 | - var mydata = JSON.parse(res.data.data.jsPayRequest); | |
| 322 | - me.MakeWxPay(mydata); | |
| 323 | - uni.hideNavigationBarLoading(); | |
| 324 | - uni.hideLoading(); | |
| 325 | - } | |
| 326 | - }, | |
| 327 | - complete: () => { | |
| 328 | - uni.hideNavigationBarLoading(); | |
| 329 | - uni.hideLoading(); | |
| 330 | - } | |
| 331 | - }); | |
| 332 | - }, | |
| 333 | - // 调用微信支付 | |
| 334 | - MakeWxPay(mydata) { | |
| 335 | - console.log('3') | |
| 336 | - var me = this; | |
| 337 | - uni.requestPayment({ | |
| 338 | - provider: 'wxpay', | |
| 339 | - timeStamp: mydata.timeStamp, | |
| 340 | - //随机字符串,长度为32个字符以下 | |
| 341 | - nonceStr: mydata.nonceStr, | |
| 342 | - //统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=xx。 | |
| 343 | - package: mydata.package, | |
| 344 | - signType: mydata.signType, | |
| 345 | - paySign: mydata.paySign, | |
| 346 | - success: function (res) { | |
| 347 | - console.log('success:' + JSON.stringify(res)); | |
| 348 | - var myurl = '../wxPaySuccess/wxPaySuccess?carNumber=' + me.mycarNumber + '&payWays=微信&payMoney=' + me.myorderinfo | |
| 349 | - .orderFee + '&appOrderTimeout=' + me.appOrderTimeout; | |
| 350 | - uni.reLaunch({ | |
| 351 | - url: myurl | |
| 352 | - }); | |
| 353 | - }, | |
| 354 | - fail: function (err) { | |
| 355 | - console.log('fail:' + JSON.stringify(err)); | |
| 356 | - uni.showModal({ | |
| 357 | - title: '提示', | |
| 358 | - content: '支付失败/取消', | |
| 359 | - showCancel: false, | |
| 360 | - success: function (res) { | |
| 361 | - if (res.confirm) { | |
| 362 | - console.log('支付失败'); | |
| 363 | - } | |
| 364 | - } | |
| 365 | - }); | |
| 366 | - } | |
| 367 | - }); | |
| 368 | - }, | |
| 369 | - goPay_billQueryInfo(carnum, orderId, parkCode, cardNo, couponType, disValue) { | |
| 370 | - var me = this; | |
| 371 | - // uni.showLoading({ | |
| 372 | - // mask: true, | |
| 373 | - // title: "请稍后..." | |
| 374 | - // }); | |
| 375 | - uni.showNavigationBarLoading(); | |
| 376 | - var billQueryUrl = common.billQueryUrl; | |
| 377 | - var jsondata = { | |
| 378 | - carNumber: carnum, | |
| 379 | - orderId: orderId, | |
| 380 | - terminalSource: '11', | |
| 381 | - parkCode: parkCode, | |
| 382 | - cardNo: cardNo, | |
| 383 | - couponType: couponType, | |
| 384 | - disValue: disValue | |
| 385 | - } | |
| 386 | - uni.request({ | |
| 387 | - url: billQueryUrl, | |
| 388 | - // data: JSON.stringify(jsondata), | |
| 389 | - data: JSON.stringify(common.requestSign(jsondata)), | |
| 390 | - header: { | |
| 391 | - 'content-type': 'application/json' | |
| 392 | - }, | |
| 393 | - dataType: "json", | |
| 394 | - method: "POST", | |
| 395 | - success: (res) => { | |
| 396 | - console.log(JSON.stringify(res.data)); | |
| 397 | - uni.hideNavigationBarLoading(); | |
| 398 | - uni.hideLoading(); | |
| 399 | - if (res.data.code == 0) { | |
| 400 | - me.myorderinfo = res.data.data; | |
| 401 | - me.appOrderTimeout = res.data.data.appOrderTimeout; | |
| 402 | - if (me.myorderinfo.orderFee == 0) { | |
| 403 | - | |
| 404 | - | |
| 405 | - // 101:停车付款单,102:停车预付单,103:停车补缴单,201:余额充值单,202:押金充值;301:会员卡购买单,302:会员卡续费 | |
| 406 | - //个人使用的卡券cardId | |
| 407 | - // couponPersonId: | |
| 408 | - // paySrcType: me.mypaySrcType, | |
| 409 | - me.zeroPayUrl(me.mypaySrcType, res.data.data.orderId, me.selCoupon.custCardId); | |
| 410 | - } else { | |
| 411 | - //用户选择微信支付 | |
| 412 | - if (me.payWaysSel == 0) { | |
| 413 | - me.getWxPayinfo(); | |
| 414 | - } else { | |
| 415 | - me.UseAccountPay(); | |
| 416 | - } | |
| 417 | - } | |
| 418 | - // me.myorderinfo1 = res.data.data ; | |
| 419 | - // | |
| 420 | - // var code = res.data.code; | |
| 421 | - //console.log(JSON.stringify(res.data)); | |
| 422 | - } else if (res.data.code == -10000) { | |
| 423 | - uni.showModal({ | |
| 424 | - title: '提示', | |
| 425 | - content: res.data.message, | |
| 426 | - showCancel: false, | |
| 427 | - success: function (res) { | |
| 428 | - if (res.confirm) { | |
| 429 | - console.log('登录失效'); | |
| 430 | - uni.clearStorageSync(); | |
| 431 | - } | |
| 432 | - } | |
| 433 | - }); | |
| 434 | - } | |
| 435 | - }, | |
| 436 | - complete: () => { | |
| 437 | - uni.hideNavigationBarLoading(); | |
| 438 | - uni.hideLoading(); | |
| 439 | - } | |
| 440 | - }); | |
| 441 | - }, | |
| 442 | - // 0元支付 | |
| 443 | - zeroPayUrl(payOrderType, orderId, couponPersonId) { | |
| 444 | - var me = this; | |
| 445 | - uni.showLoading({ | |
| 446 | - mask: true, | |
| 447 | - title: "请稍后..." | |
| 448 | - }); | |
| 449 | - uni.showNavigationBarLoading(); | |
| 450 | - var zeroPayUrl = common.zeroPayUrl; | |
| 451 | - var jsondata = { | |
| 452 | - payOrderType: payOrderType, | |
| 453 | - orderId: orderId, | |
| 454 | - terminalSource: '11', | |
| 455 | - couponPersonId: couponPersonId | |
| 456 | - } | |
| 457 | - uni.request({ | |
| 458 | - url: zeroPayUrl, | |
| 459 | - // data: JSON.stringify(jsondata), | |
| 460 | - data: JSON.stringify(common.requestSign(jsondata)), | |
| 461 | - header: { | |
| 462 | - 'content-type': 'application/json' | |
| 463 | - }, | |
| 464 | - dataType: "json", | |
| 465 | - method: "POST", | |
| 466 | - success: (res) => { | |
| 467 | - console.log(JSON.stringify(res.data)); | |
| 468 | - uni.hideNavigationBarLoading(); | |
| 469 | - uni.hideLoading(); | |
| 470 | - if (res.data.code == 0) { | |
| 471 | - uni.showModal({ | |
| 472 | - title: '提示', | |
| 473 | - content: '支付成功!', | |
| 474 | - showCancel: false, | |
| 475 | - success: function (res) { | |
| 476 | - me.GetbillQueryInfo(me.mycarNumber, me.myorderId, me.myparkCode, me.selCoupon.cardNo, me.selCoupon.couponType, | |
| 477 | - me.selCoupon | |
| 478 | - .discValue); | |
| 479 | - } | |
| 480 | - }); | |
| 481 | - // me.myorderinfo = res.data.data; | |
| 482 | - // me.appOrderTimeout = res.data.data.appOrderTimeout; | |
| 483 | - // // me.myorderinfo1 = res.data.data ; | |
| 484 | - // | |
| 485 | - // var code = res.data.code; | |
| 486 | - //console.log(JSON.stringify(res.data)); | |
| 487 | - } else if (res.data.code == -10000) { | |
| 488 | - uni.showModal({ | |
| 489 | - title: '提示', | |
| 490 | - content: res.data.message, | |
| 491 | - showCancel: false, | |
| 492 | - success: function (res) { | |
| 493 | - if (res.confirm) { | |
| 494 | - console.log('登录失效'); | |
| 495 | - uni.clearStorageSync(); | |
| 496 | - } | |
| 497 | - } | |
| 498 | - }); | |
| 499 | - } else { | |
| 500 | - uni.showModal({ | |
| 501 | - title: '提示', | |
| 502 | - content: res.data.message, | |
| 503 | - showCancel: false, | |
| 504 | - success: function (res) { | |
| 505 | - me.GetbillQueryInfo(me.mycarNumber, me.myorderId, me.myparkCode, me.selCoupon.cardNo, me.selCoupon.couponType, | |
| 506 | - me.selCoupon | |
| 507 | - .discValue); | |
| 508 | - } | |
| 509 | - }); | |
| 510 | - } | |
| 511 | - }, | |
| 512 | - complete: () => { | |
| 513 | - uni.hideNavigationBarLoading(); | |
| 514 | - uni.hideLoading(); | |
| 515 | - } | |
| 516 | - }); | |
| 517 | - }, | |
| 518 | - //初始化订单信息 | |
| 519 | - GetbillQueryInfo(carnum, orderId, parkCode, cardNo, couponType, disValue) { | |
| 520 | - var me = this; | |
| 521 | - uni.showLoading({ | |
| 522 | - mask: true, | |
| 523 | - title: "请稍后..." | |
| 524 | - }); | |
| 525 | - uni.showNavigationBarLoading(); | |
| 526 | - var billQueryUrl = common.billQueryUrl; | |
| 527 | - var jsondata = { | |
| 528 | - carNumber: carnum, | |
| 529 | - orderId: orderId, | |
| 530 | - terminalSource: '11', | |
| 531 | - parkCode: parkCode, | |
| 532 | - cardNo: cardNo, | |
| 533 | - couponType: couponType, | |
| 534 | - disValue: disValue | |
| 535 | - } | |
| 536 | - uni.request({ | |
| 537 | - url: billQueryUrl, | |
| 538 | - // data: JSON.stringify(jsondata), | |
| 539 | - data: JSON.stringify(common.requestSign(jsondata)), | |
| 540 | - header: { | |
| 541 | - 'content-type': 'application/json' | |
| 542 | - }, | |
| 543 | - dataType: "json", | |
| 544 | - method: "POST", | |
| 545 | - success: (res) => { | |
| 546 | - console.log(JSON.stringify(res.data)); | |
| 547 | - uni.hideNavigationBarLoading(); | |
| 548 | - uni.hideLoading(); | |
| 549 | - if (res.data.code == 0) { | |
| 550 | - me.myorderinfo = res.data.data; | |
| 551 | - me.appOrderTimeout = res.data.data.appOrderTimeout; | |
| 552 | - // me.myorderinfo1 = res.data.data ; | |
| 553 | - // | |
| 554 | - // var code = res.data.code; | |
| 555 | - //console.log(JSON.stringify(res.data)); | |
| 556 | - } else if (res.data.code == -10000) { | |
| 557 | - uni.showModal({ | |
| 558 | - title: '提示', | |
| 559 | - content: res.data.message, | |
| 560 | - showCancel: false, | |
| 561 | - success: function (res) { | |
| 562 | - if (res.confirm) { | |
| 563 | - console.log('登录失效'); | |
| 564 | - uni.clearStorageSync(); | |
| 565 | - } | |
| 566 | - } | |
| 567 | - }); | |
| 568 | - } | |
| 569 | - }, | |
| 570 | - complete: () => { | |
| 571 | - uni.hideNavigationBarLoading(); | |
| 572 | - uni.hideLoading(); | |
| 573 | - } | |
| 574 | - }); | |
| 575 | - }, | |
| 576 | - // 获取openid | |
| 577 | - getWxCode() { | |
| 578 | - var that = this; | |
| 579 | - uni.login({ | |
| 580 | - provider: 'weixin', | |
| 581 | - success: function (loginRes) { | |
| 582 | - console.log(JSON.stringify(loginRes)); | |
| 583 | - console.log(loginRes.code); | |
| 584 | - that.get_WxOpenid(loginRes.code); | |
| 585 | - } | |
| 586 | - }); | |
| 101 | + console.log(index+1) | |
| 102 | + | |
| 587 | 103 | }, |
| 588 | - get_WxOpenid(code) { | |
| 589 | - var me = this; | |
| 590 | - console.log('123456'); | |
| 591 | - uni.showLoading({ | |
| 592 | - mask: true, | |
| 593 | - title: "请稍后..." | |
| 594 | - }); | |
| 595 | - uni.showNavigationBarLoading(); | |
| 596 | - var getOpenidUrl = common.getOpenidUrl; | |
| 597 | - uni.request({ | |
| 598 | - url: getOpenidUrl, | |
| 599 | - data: { | |
| 600 | - appId: common.hs_wxPay_appId, | |
| 601 | - code: code | |
| 602 | - }, | |
| 603 | - header: { | |
| 604 | - 'content-type': 'application/json' | |
| 605 | - }, | |
| 606 | - dataType: "json", | |
| 607 | - method: "POST", | |
| 608 | - success: (res) => { | |
| 609 | - console.log(res) | |
| 610 | - if (res.data.code == 0) { | |
| 611 | - console.log('id') | |
| 612 | - // me.myorderinfo = res.data.data; | |
| 613 | - // // var code = res.data.code; | |
| 614 | - uni.setStorageSync("WxOpenid", res.data.data.openid); | |
| 615 | - console.log(JSON.stringify(res.data)); | |
| 616 | - console.log("wxopenid = " + res.data.data.openid); | |
| 617 | - uni.hideNavigationBarLoading(); | |
| 618 | - uni.hideLoading(); | |
| 619 | - } | |
| 620 | - }, | |
| 621 | - complete: () => { | |
| 622 | - uni.hideNavigationBarLoading(); | |
| 623 | - uni.hideLoading(); | |
| 624 | - } | |
| 625 | - }); | |
| 626 | - }, | |
| 627 | - // 使用余额支付 | |
| 628 | - UseAccountPay() { | |
| 629 | - var me = this; | |
| 630 | - console.log(me.loginflag + 'aaaaa') | |
| 631 | - if (me.loginflag == 0) { | |
| 632 | - console.log('123123') | |
| 633 | - // this.alertFlag = true | |
| 634 | - // uni.showToast({ | |
| 635 | - // title: '请先登录', | |
| 636 | - // icon: 'none', | |
| 637 | - // duration: 4000 | |
| 638 | - // }) | |
| 639 | - uni.showModal({ | |
| 640 | - title: '提示', | |
| 641 | - showCancel: false, | |
| 642 | - content: '未登录状态,请先登录!', | |
| 643 | - success: function (res) { | |
| 644 | - if (res.confirm) { | |
| 645 | - console.log('用户点击确定'); | |
| 646 | - } | |
| 647 | - } | |
| 648 | - }); | |
| 649 | - } else { | |
| 650 | - console.log('bbbb') | |
| 651 | - uni.showLoading({ | |
| 652 | - mask: true, | |
| 653 | - title: "请稍后...", | |
| 654 | - duration: 4000 | |
| 655 | - }); | |
| 656 | - uni.showNavigationBarLoading(); | |
| 657 | - var accountPayUrl = common.accountPayUrl; | |
| 658 | - var jsondata = { | |
| 659 | - payType: '5', //支付方式-- 1:支付宝 2:微信 3:银联 4:微信公众号 5 个人账户 | |
| 660 | - orderId: me.myorderId, | |
| 661 | - payFee: me.myorderinfo.orderFee, | |
| 662 | - //支付单来源 101:停车付款单 102:停车预付单 103:停车补缴单 104 共享车位 201 余额充值单 202 押金充值单 301 会员卡购买单 302 会员卡续费 | |
| 663 | - paySrcType: me.mypaySrcType, | |
| 664 | - terminalSource: '11', //小程序 | |
| 665 | - //个人使用的卡券cardId | |
| 666 | - couponPersonId: me.selCoupon.custCardId, | |
| 667 | - carNumber: me.mycarNumber, | |
| 668 | - orderId: me.myorderId, | |
| 669 | - paySource: '3', | |
| 670 | - sourceType: '3', | |
| 671 | - terminalSource: '11', //小程序 | |
| 672 | - recordArreaInfos: JSON.stringify([{ | |
| 673 | - "orderId": me.myorderId, | |
| 674 | - "orderNotPayFee": me.myorderinfo.orderFee, | |
| 675 | - "parkId": me.myparkCode | |
| 676 | - }]) | |
| 677 | - }; | |
| 678 | - uni.request({ | |
| 679 | - url: accountPayUrl, | |
| 680 | - data: JSON.stringify(common.requestSign(jsondata)), | |
| 681 | - header: { | |
| 682 | - 'content-type': 'application/json' | |
| 683 | - }, | |
| 684 | - dataType: "json", | |
| 685 | - method: "POST", | |
| 686 | - success: (res) => { | |
| 687 | - uni.hideNavigationBarLoading(); | |
| 688 | - uni.hideLoading(); | |
| 689 | - console.log('余额支付 = ' + JSON.stringify(res.data)); | |
| 690 | - if (res.data.code == 0) { | |
| 691 | - var myurl = '../wxPaySuccess/wxPaySuccess?carNumber=' + me.mycarNumber + '&payWays=余额&payMoney=' + me.myorderinfo | |
| 692 | - .orderFee + '&appOrderTimeout=' + me.appOrderTimeout; | |
| 693 | - uni.reLaunch({ | |
| 694 | - url: myurl | |
| 695 | - }); | |
| 696 | - } else { | |
| 697 | - uni.showToast({ | |
| 698 | - title: res.data.message, | |
| 699 | - icon: 'none', | |
| 700 | - duration: 4000 | |
| 701 | - }) | |
| 702 | - } | |
| 703 | - }, | |
| 704 | - complete: () => { | |
| 705 | - // uni.hideNavigationBarLoading(); | |
| 706 | - // uni.hideLoading(); | |
| 707 | - } | |
| 708 | - }); | |
| 709 | - } | |
| 710 | - } | |
| 711 | - } | |
| 104 | + | |
| 105 | + } | |
| 712 | 106 | } |
| 713 | 107 | </script> |
| 714 | 108 | ... | ... |
pages/setting/setting.vue
| 1 | 1 | <template> |
| 2 | 2 | <view> |
| 3 | 3 | <view class="setting-content"> |
| 4 | - <uni-list v-for="(key,index) in listInfo " :key="index"> | |
| 5 | - <uni-list-item :title="key.listTitle" clickable @click="selCell(index)" showArrow></uni-list-item> | |
| 4 | + <uni-list> | |
| 5 | + <uni-list-item title="关于我们" clickable @click="toAboutOur" showArrow></uni-list-item> | |
| 6 | + <uni-list-item title="清除缓存" clickable @click="cleanStorage" ></uni-list-item> | |
| 6 | 7 | </uni-list> |
| 7 | - | |
| 8 | + | |
| 8 | 9 | <view class="uni-padding-wrap uni-common-mt"> |
| 9 | - <button type="warn" @click="loginOut">退出登录</button> | |
| 10 | + <button type="warn" @click="loginOutAlert">退出登录</button> | |
| 10 | 11 | </view> |
| 11 | 12 | |
| 12 | 13 | </view> |
| 13 | - | |
| 14 | + | |
| 14 | 15 | </view> |
| 15 | 16 | </template> |
| 16 | 17 | |
| 17 | 18 | <script> |
| 18 | - import common from "../../common/common.js"; | |
| 19 | 19 | |
| 20 | 20 | export default { |
| 21 | 21 | data() { |
| 22 | 22 | return { |
| 23 | - // userIsLogin: false, | |
| 24 | - // userInfo: {}, | |
| 25 | - listInfo: [{ | |
| 26 | - listTitle: '使用指南', | |
| 27 | - // listIcon: '../../static/me/me-balance.png' | |
| 28 | - }, | |
| 29 | - { | |
| 30 | - listTitle: '关于我们', | |
| 31 | - // listIcon: '../../static/me/me-aboutus.png' | |
| 32 | - }, | |
| 33 | - { | |
| 34 | - listTitle: '清除缓存', | |
| 35 | - // listIcon: '../../static/me/me-carm.png' | |
| 36 | - } | |
| 37 | - | |
| 38 | - | |
| 39 | - ] | |
| 23 | + | |
| 40 | 24 | } |
| 41 | 25 | }, |
| 42 | 26 | methods: { |
| 43 | - selCell(e) { | |
| 44 | - var _this = this; | |
| 45 | - var name = _this.listInfo[e].listTitle; | |
| 46 | - | |
| 47 | - switch (name) { | |
| 48 | - case '使用指南': { | |
| 49 | - | |
| 50 | - uni.navigateTo({ | |
| 51 | - url: '../manuals/manuals' | |
| 52 | - | |
| 53 | - }); | |
| 27 | + toAboutOur() { | |
| 28 | + uni.navigateTo({ | |
| 29 | + url: '../aboutOur/aboutOur' | |
| 30 | + | |
| 31 | + }); | |
| 32 | + }, | |
| 33 | + cleanStorage() { | |
| 34 | + uni.clearStorageSync(); | |
| 35 | + uni.showToast({ | |
| 36 | + title: "清理缓存成功", | |
| 37 | + mask: false, | |
| 38 | + duration:2000 | |
| 39 | + }) | |
| 40 | + }, | |
| 41 | + loginOutAlert(){ | |
| 42 | + let that = this; | |
| 43 | + uni.showModal({ | |
| 44 | + title:'提示', | |
| 45 | + content:'是否确定退出登录?', | |
| 46 | + success: (res) => { | |
| 47 | + if(res.confirm){ | |
| 48 | + that.loginOut(); | |
| 49 | + }else if(res.cancel){ | |
| 50 | + console.log('用户点击取消') | |
| 51 | + } | |
| 54 | 52 | } |
| 55 | - break; | |
| 56 | - | |
| 57 | - case '关于我们': //关于我们 | |
| 58 | - { | |
| 59 | - | |
| 60 | - uni.navigateTo({ | |
| 61 | - url: '../aboutOur/aboutOur' | |
| 62 | - | |
| 63 | - }); | |
| 64 | - } | |
| 65 | - break; | |
| 66 | - default: | |
| 67 | - break; | |
| 68 | - } | |
| 53 | + }) | |
| 54 | + | |
| 55 | + }, | |
| 56 | + loginOut(){ | |
| 57 | + let that = this; | |
| 58 | + that.$myRequest({ | |
| 59 | + url: that.$common.userLoginout, | |
| 60 | + method: 'POST', | |
| 61 | + data: that.$common.requestSign() | |
| 62 | + }).then(res => { | |
| 63 | + // 获取真实数据之前,务必判断状态是否为200 | |
| 64 | + console.log('退出:' + JSON.stringify(res)); | |
| 65 | + if (res.code == 0) { | |
| 66 | + | |
| 67 | + uni.clearStorageSync(); | |
| 68 | + uni.reLaunch({ | |
| 69 | + url: "../index/index" | |
| 70 | + }) | |
| 71 | + uni.hideLoading(); | |
| 72 | + | |
| 73 | + } else { | |
| 74 | + | |
| 75 | + uni.clearStorageSync(); | |
| 76 | + uni.reLaunch({ | |
| 77 | + url: "../index/index" | |
| 78 | + }) | |
| 79 | + uni.hideLoading(); | |
| 80 | + | |
| 81 | + } | |
| 82 | + | |
| 83 | + }) | |
| 69 | 84 | } |
| 70 | 85 | } |
| 71 | 86 | } |
| ... | ... | @@ -76,6 +91,4 @@ |
| 76 | 91 | background-color: #f6f6f6; |
| 77 | 92 | height: 100vh; |
| 78 | 93 | } |
| 79 | - | |
| 80 | - | |
| 81 | 94 | </style> | ... | ... |