|
|
@@ -42,7 +42,7 @@
|
|
|
<block v-else-if="pagestatus == 6">
|
|
|
<div class="call-back-wrap">
|
|
|
<div class="qr-code-img">
|
|
|
- <img :src="shopUser.smallWxQrCodeUrl" alt="二维码" mode="widthFix" />
|
|
|
+ <img :src="merchantInfo.smallWxQrCodeUrl" alt="二维码" mode="widthFix" />
|
|
|
</div>
|
|
|
<div class="app-color-2">最后一步</div>
|
|
|
<div class="app-color-2">识别二维码并关注公众号</div>
|
|
|
@@ -97,11 +97,17 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</modal-module>
|
|
|
+ <!-- 未设置支付密码弹窗 -->
|
|
|
+ <alert-module :show="setPassModal" btnText="去设置" btnColor="#FF2842" padding="66rpx 24rpx 66rpx 24rpx" @click="hideAlert">
|
|
|
+ <div class="go-login-module">
|
|
|
+ <div>暂未设置密码,去设置密码!</div>
|
|
|
+ </div>
|
|
|
+ </alert-module>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-/** *
|
|
|
+ /** *
|
|
|
* 页面状态
|
|
|
* @parmas pagestatus 进入页面的状态
|
|
|
* @parmas 1 待支付 - 余额支付 或者 微信支付 -- awaitPayYe
|
|
|
@@ -111,154 +117,174 @@
|
|
|
* @parmas 5 支付成功 - 扫码支付 -- successPayCode
|
|
|
* @parmas 6 申请成功 - 申请会员 -- registerMember
|
|
|
*/
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import ModalModule from '@/components/plugin/modal'
|
|
|
-// api
|
|
|
-import wexinPay from '@/utils/pay/wxPay'
|
|
|
-import { getShopUser } from '@/utils/auth'
|
|
|
-import { balancePay, wxPay } from '@/api/order'
|
|
|
-export default {
|
|
|
- name: 'callback',
|
|
|
- components: {
|
|
|
- ModalModule
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- constant: this.$constant,
|
|
|
- pageTit: '',
|
|
|
- pagestatus: 1,
|
|
|
- contentClass: '',
|
|
|
- payDiscountPrice: null,
|
|
|
- // 支付相关 ============
|
|
|
- passwordModal: false,
|
|
|
- form: {
|
|
|
- payPassword: ''
|
|
|
- },
|
|
|
+ import { mapGetters } from 'vuex'
|
|
|
+ import ModalModule from '@/components/plugin/modal'
|
|
|
+ import AlertModule from '@/components/plugin/alert'
|
|
|
+ // api
|
|
|
+ import wexinPay from '@/utils/pay/wxPay'
|
|
|
+ import { getMerchantInfo } from '@/api/common'
|
|
|
+ import { getShopUser } from '@/utils/auth'
|
|
|
+ import { balancePay, wxPay } from '@/api/order'
|
|
|
+ export default {
|
|
|
+ name: 'callback',
|
|
|
+ components: {
|
|
|
+ ModalModule,
|
|
|
+ AlertModule
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ constant: this.$constant,
|
|
|
+ pageTit: '',
|
|
|
+ pagestatus: 1,
|
|
|
+ contentClass: '',
|
|
|
+ payDiscountPrice: null,
|
|
|
+ // 支付相关 ============
|
|
|
+ passwordModal: false,
|
|
|
+ form: {
|
|
|
+ payPassword: ''
|
|
|
+ },
|
|
|
|
|
|
- payCallData: {}
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapGetters({ shopUser: 'getShopUser' }),
|
|
|
- isYeBtnShow() {
|
|
|
- if (this.$util.isEmpty(this.shopUser)) return false
|
|
|
- return this.shopUser.userAsset.balance > this.option.totalPrice
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad() {
|
|
|
- // if (this.pagestatus) {
|
|
|
- // this.init()
|
|
|
- // }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- init() {
|
|
|
- this.pagestatus = this.option.pagestatus
|
|
|
- this.payDiscountPrice = this.option.payDiscountPrice
|
|
|
- this.initClass(this.pagestatus)
|
|
|
- getShopUser()
|
|
|
+ payCallData: {},
|
|
|
+ merchantInfo: {},
|
|
|
+ // 未设置密码
|
|
|
+ setPassModal: false
|
|
|
+ }
|
|
|
},
|
|
|
- // 支付相关块 =======================================================
|
|
|
- // 余额支付
|
|
|
- _balancePay() {
|
|
|
- if (!this.form.payPassword) {
|
|
|
- this.$msg('请先输入支付密码!')
|
|
|
- return false
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({ shopUser: 'getShopUser' }),
|
|
|
+ isYeBtnShow() {
|
|
|
+ if (this.$util.isEmpty(this.shopUser)) return false
|
|
|
+ return this.shopUser.userAsset.balance > this.option.totalPrice
|
|
|
}
|
|
|
- balancePay({
|
|
|
- payPassword: this.form.payPassword,
|
|
|
- orderSn: this.option.orderSn,
|
|
|
- couponId: this.option.couponId
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.modalCancel()
|
|
|
- this.$msg('支付成功!')
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ // if (this.pagestatus) {
|
|
|
+ // this.init()
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ this.pagestatus = this.option.pagestatus
|
|
|
+ this.payDiscountPrice = this.option.payDiscountPrice
|
|
|
+ this.initClass(this.pagestatus)
|
|
|
+ getShopUser()
|
|
|
+ // 商户信息
|
|
|
+ // if (this.pagestatus == 6) {
|
|
|
+ getMerchantInfo().then(res => {
|
|
|
+ this.merchantInfo = res.data
|
|
|
+ })
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ // 支付相关块 =======================================================
|
|
|
+ // 余额支付
|
|
|
+ _balancePay() {
|
|
|
+ if (!this.form.payPassword) {
|
|
|
+ this.$msg('请先输入支付密码!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ balancePay({
|
|
|
+ payPassword: this.form.payPassword,
|
|
|
+ orderSn: this.option.orderSn,
|
|
|
+ couponId: this.option.couponId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.modalCancel()
|
|
|
+ this.$msg('支付成功!')
|
|
|
|
|
|
+ this.payCallData = res.data
|
|
|
+ this.paySuccess()
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$msg(e.msg)
|
|
|
+ this.payFail(e)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 微信支付
|
|
|
+ _wxPay() {
|
|
|
+ wxPay({
|
|
|
+ orderSn: this.option.orderSn,
|
|
|
+ couponId: this.option.couponId
|
|
|
+ }).then(res => {
|
|
|
this.payCallData = res.data
|
|
|
- this.paySuccess()
|
|
|
+ wexinPay(res.data, this.paySuccess, this.payFail)
|
|
|
})
|
|
|
- .catch(e => {
|
|
|
- this.$msg(e.msg)
|
|
|
- this.payFail(e)
|
|
|
+ },
|
|
|
+ paySuccess() {
|
|
|
+ this.$util.pageTo({
|
|
|
+ url: '/pages/callback/index',
|
|
|
+ type: 2,
|
|
|
+ query: {
|
|
|
+ ...this.option,
|
|
|
+ pagestatus: 3,
|
|
|
+ // orderSn: this.option.orderSn,
|
|
|
+ payDiscountPrice: this.payCallData.discountAmount
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
- // 微信支付
|
|
|
- _wxPay() {
|
|
|
- wxPay({
|
|
|
- orderSn: this.option.orderSn,
|
|
|
- couponId: this.option.couponId
|
|
|
- }).then(res => {
|
|
|
- this.payCallData = res.data
|
|
|
- wexinPay(res.data, this.paySuccess, this.payFail)
|
|
|
- })
|
|
|
- },
|
|
|
- paySuccess() {
|
|
|
- this.$util.pageTo({
|
|
|
- url: '/pages/callback/index',
|
|
|
- type: 2,
|
|
|
- query: {
|
|
|
- ...this.option,
|
|
|
- pagestatus: 3,
|
|
|
- // orderSn: this.option.orderSn,
|
|
|
- payDiscountPrice: this.payCallData.discountAmount
|
|
|
+ },
|
|
|
+ payFail() {
|
|
|
+ alert('支付失败!')
|
|
|
+ },
|
|
|
+ balancePayFn() {
|
|
|
+ if (this.merchantInfo.hasPayPwd == 0) {
|
|
|
+ this.setPassModal = true
|
|
|
+ } else {
|
|
|
+ this.passwordModal = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ passwordModalClick(e) {
|
|
|
+ if (e.index === 0) {
|
|
|
+ this.modalCancel()
|
|
|
+ } else {
|
|
|
+ this._balancePay()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ modalCancel() {
|
|
|
+ this.passwordModal = false
|
|
|
+ this.form.payPassword = ''
|
|
|
+ },
|
|
|
+ // 暂未设置密码
|
|
|
+ hideAlert() {
|
|
|
+ this.$util.pageTo('/pages/user/password')
|
|
|
+ },
|
|
|
+ // 初始样式
|
|
|
+ initClass(val) {
|
|
|
+ switch (val) {
|
|
|
+ case '1':
|
|
|
+ this.pageTit = '待支付'
|
|
|
+ this.contentClass = 'awaitPayYe'
|
|
|
+ break
|
|
|
+ case '2':
|
|
|
+ this.pageTit = '待支付'
|
|
|
+ this.contentClass = 'awaitPayWx'
|
|
|
+ break
|
|
|
+ case '3':
|
|
|
+ this.pageTit = '支付成功'
|
|
|
+ this.contentClass = 'successPay'
|
|
|
+ break
|
|
|
+ case '4':
|
|
|
+ this.pageTit = '评价成功'
|
|
|
+ this.contentClass = 'successEval'
|
|
|
+ break
|
|
|
+ case '5':
|
|
|
+ this.pageTit = '支付成功'
|
|
|
+ this.contentClass = 'successPayCode'
|
|
|
+ break
|
|
|
+ case '6':
|
|
|
+ this.pageTit = '提交成功'
|
|
|
+ this.contentClass = 'registerMember'
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ this.pageTit = '支付成功'
|
|
|
+ this.contentClass = 'awaitPayYe'
|
|
|
+ break
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- payFail() {
|
|
|
- alert('支付失败!')
|
|
|
- },
|
|
|
- balancePayFn() {
|
|
|
- this.passwordModal = true
|
|
|
- },
|
|
|
- passwordModalClick(e) {
|
|
|
- if (e.index === 0) {
|
|
|
- this.modalCancel()
|
|
|
- } else {
|
|
|
- this._balancePay()
|
|
|
- }
|
|
|
- },
|
|
|
- modalCancel() {
|
|
|
- this.passwordModal = false
|
|
|
- this.form.payPassword = ''
|
|
|
- },
|
|
|
- // 初始样式
|
|
|
- initClass(val) {
|
|
|
- switch (val) {
|
|
|
- case '1':
|
|
|
- this.pageTit = '待支付'
|
|
|
- this.contentClass = 'awaitPayYe'
|
|
|
- break
|
|
|
- case '2':
|
|
|
- this.pageTit = '待支付'
|
|
|
- this.contentClass = 'awaitPayWx'
|
|
|
- break
|
|
|
- case '3':
|
|
|
- this.pageTit = '支付成功'
|
|
|
- this.contentClass = 'successPay'
|
|
|
- break
|
|
|
- case '4':
|
|
|
- this.pageTit = '评价成功'
|
|
|
- this.contentClass = 'successEval'
|
|
|
- break
|
|
|
- case '5':
|
|
|
- this.pageTit = '支付成功'
|
|
|
- this.contentClass = 'successPayCode'
|
|
|
- break
|
|
|
- case '6':
|
|
|
- this.pageTit = '提交成功'
|
|
|
- this.contentClass = 'registerMember'
|
|
|
- break
|
|
|
- default:
|
|
|
- this.pageTit = '支付成功'
|
|
|
- this.contentClass = 'awaitPayYe'
|
|
|
- break
|
|
|
- }
|
|
|
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: this.pageTit
|
|
|
- })
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: this.pageTit
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|