|
@@ -9,26 +9,39 @@
|
|
|
<div class="logo-img">
|
|
<div class="logo-img">
|
|
|
<img src="../../static/images/user/attr-default.png" alt mode="widthFix" />
|
|
<img src="../../static/images/user/attr-default.png" alt mode="widthFix" />
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="app-size-30">国兰花尚</div>
|
|
|
|
|
|
|
+ <div class="app-size-30">{{ shopUser.userName }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="pay-input-wrap">
|
|
<div class="pay-input-wrap">
|
|
|
- <pay-input-module :focus="inpFocus" :num="amount" @focusFn="focusFn" @blurFn="blurFn" @clickKey="clickKeyFn" />
|
|
|
|
|
|
|
+ <pay-input-module :focus="inpFocus" :num="form.prePrice" @focusFn="focusFn" @blurFn="blurFn" @clickKey="clickKeyFn" />
|
|
|
<div class="balance">
|
|
<div class="balance">
|
|
|
<span>账户余额 ¥</span>
|
|
<span>账户余额 ¥</span>
|
|
|
- <span class="app-size-30">2872.09</span>
|
|
|
|
|
|
|
+ <span class="app-size-30">{{ shopUser.userAsset.balance }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 按钮 -->
|
|
<!-- 按钮 -->
|
|
|
<div class="btn-wrap">
|
|
<div class="btn-wrap">
|
|
|
- <button class="button-com red" @click="_pay">余额支付</button>
|
|
|
|
|
- <button class="button-com green" @click="_pay">微信支付</button>
|
|
|
|
|
|
|
+ <button class="button-com red" @click="balancePayFn">余额支付</button>
|
|
|
|
|
+ <button class="button-com green" @click="wexinPayFn">微信支付</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</block>
|
|
</block>
|
|
|
<!-- 我要配送 -->
|
|
<!-- 我要配送 -->
|
|
|
<block v-else>
|
|
<block v-else>
|
|
|
- <app-delivery-module />
|
|
|
|
|
|
|
+ <app-delivery-module ref="appDelivery" />
|
|
|
</block>
|
|
</block>
|
|
|
<!-- <button @click="_pay">提交</button> -->
|
|
<!-- <button @click="_pay">提交</button> -->
|
|
|
|
|
+ <!-- 支付密码弹窗 -->
|
|
|
|
|
+ <modal-module :show="passwordModal" @cancel="modalCancel" @click="passwordModalClick" :maskClosable="false" title="支付密码" padding="30rpx 30rpx">
|
|
|
|
|
+ <template v-slot:content>
|
|
|
|
|
+ <div class="app-modal-input-wrap">
|
|
|
|
|
+ <div class="inp-list-line">
|
|
|
|
|
+ <!-- <div class="line-label">支付密码</div> -->
|
|
|
|
|
+ <div class="line-input">
|
|
|
|
|
+ <input type="password" v-model="form.payPassword" :adjust-position="false" class="inp-input" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </modal-module>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -36,11 +49,13 @@
|
|
|
import AppTabs from '@/components/plugin/tabs'
|
|
import AppTabs from '@/components/plugin/tabs'
|
|
|
import PayInputModule from './components/pay-input'
|
|
import PayInputModule from './components/pay-input'
|
|
|
import AppDeliveryModule from '@/components/app-delivery'
|
|
import AppDeliveryModule from '@/components/app-delivery'
|
|
|
-import { getMiniAppUrl } from '@/utils/common'
|
|
|
|
|
|
|
+// import { getMiniAppUrl } from '@/utils/common'
|
|
|
import { getCheckLogin } from '@/utils/auth'
|
|
import { getCheckLogin } from '@/utils/auth'
|
|
|
import wexinPay from '@/utils/pay/wxPay'
|
|
import wexinPay from '@/utils/pay/wxPay'
|
|
|
-import { pay } from '@/api/pay'
|
|
|
|
|
|
|
+// api
|
|
|
|
|
+import { fastPay } from '@/api/pay'
|
|
|
import { oauth } from '@/api/login'
|
|
import { oauth } from '@/api/login'
|
|
|
|
|
+import { getShopUser } from '@/utils/auth'
|
|
|
export default {
|
|
export default {
|
|
|
name: 'pay',
|
|
name: 'pay',
|
|
|
components: {
|
|
components: {
|
|
@@ -51,8 +66,6 @@ export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
constant: this.$constant,
|
|
constant: this.$constant,
|
|
|
- option: '',
|
|
|
|
|
- amount: '',
|
|
|
|
|
inpFocus: false,
|
|
inpFocus: false,
|
|
|
// tab
|
|
// tab
|
|
|
tabIndex: 0,
|
|
tabIndex: 0,
|
|
@@ -63,34 +76,57 @@ export default {
|
|
|
{
|
|
{
|
|
|
name: '我要配送'
|
|
name: '我要配送'
|
|
|
}
|
|
}
|
|
|
- ]
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ // 初始form
|
|
|
|
|
+ form: {
|
|
|
|
|
+ prePrice: '',
|
|
|
|
|
+ payWay: 0 // 0微信 1支付宝 2余额
|
|
|
|
|
+ },
|
|
|
|
|
+ // 支付相关 ============
|
|
|
|
|
+ passwordModal: false,
|
|
|
|
|
+ modalForm: {
|
|
|
|
|
+ payPassword: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ appendFrm: {
|
|
|
|
|
+ anonymity: '0', // 是否匿名 0不 1要
|
|
|
|
|
+ sendDistance: '', // 配送距离,根据腾讯js进行计算
|
|
|
|
|
+ // goodsId: '', // 【商城下单特有字段】商品id
|
|
|
|
|
+ // goodsStyleId: '', // 【商城下单特有字段】商品款式id
|
|
|
|
|
+ // goodsNum: '', // 【商城下单特有字段】商品数量
|
|
|
|
|
+ // couponId: '0', // 优惠券id,默认0没有使用优惠券
|
|
|
|
|
+ receiveLat: '', // 收花人纬度
|
|
|
|
|
+ receiveLong: '' // 收花人经度
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapGetters({ shopUser: 'getShopUser' })
|
|
|
|
|
+ },
|
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
|
this.option = this.$util.isEmpty(option) || {
|
|
this.option = this.$util.isEmpty(option) || {
|
|
|
account: 12358,
|
|
account: 12358,
|
|
|
shopId: 15680
|
|
shopId: 15680
|
|
|
}
|
|
}
|
|
|
- // this.init()
|
|
|
|
|
|
|
+ this.init()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
init() {
|
|
init() {
|
|
|
- getCheckLogin()
|
|
|
|
|
|
|
+ // getCheckLogin().then(res => {})
|
|
|
|
|
+ getShopUser()
|
|
|
},
|
|
},
|
|
|
_pay() {
|
|
_pay() {
|
|
|
- if (!this.amount) {
|
|
|
|
|
|
|
+ if (!this.form.prePrice) {
|
|
|
this.$msg('请先输入金额!')
|
|
this.$msg('请先输入金额!')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
let params = {
|
|
let params = {
|
|
|
- prePrice: this.amount,
|
|
|
|
|
- sourceType: 1,
|
|
|
|
|
- shopId: 15680
|
|
|
|
|
|
|
+ needSend: this.tabIndex == 0 ? '1' : '0',
|
|
|
|
|
+ prePrice: this.amount
|
|
|
|
|
+ // sourceType: 1,
|
|
|
|
|
+ // shopId: 15680
|
|
|
}
|
|
}
|
|
|
- pay(params).then(res => {
|
|
|
|
|
- console.log(res)
|
|
|
|
|
|
|
+ fastPay(params).then(res => {
|
|
|
wexinPay(res.data, this.paySuccess, this.payFail)
|
|
wexinPay(res.data, this.paySuccess, this.payFail)
|
|
|
- console.log(wexinPay)
|
|
|
|
|
// window.location.href = res.data.pay_button.mweb_url
|
|
// window.location.href = res.data.pay_button.mweb_url
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -110,9 +146,39 @@ export default {
|
|
|
clickKeyFn(val) {
|
|
clickKeyFn(val) {
|
|
|
this.amount = val
|
|
this.amount = val
|
|
|
},
|
|
},
|
|
|
|
|
+ // 微信支付
|
|
|
|
|
+ wexinPayFn() {
|
|
|
|
|
+ this.form.payWay = 0
|
|
|
|
|
+ this._pay()
|
|
|
|
|
+ },
|
|
|
|
|
+ // 余额支付
|
|
|
|
|
+ balancePayFn() {
|
|
|
|
|
+ this.form.payWay = 2
|
|
|
|
|
+ this.passwordModal = true
|
|
|
|
|
+ },
|
|
|
|
|
+ passwordModalClick(e) {
|
|
|
|
|
+ if (e.index === 0) {
|
|
|
|
|
+ this.modalCancel()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this._pay()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ modalCancel() {
|
|
|
|
|
+ this.passwordModal = false
|
|
|
|
|
+ this.modalForm.payPassword = ''
|
|
|
|
|
+ },
|
|
|
// 支付成功
|
|
// 支付成功
|
|
|
paySuccess() {
|
|
paySuccess() {
|
|
|
alert('支付成功!')
|
|
alert('支付成功!')
|
|
|
|
|
+ this.$util.pageTo({
|
|
|
|
|
+ url: '/pages/callback/index',
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ query: {
|
|
|
|
|
+ pagestatus: 3
|
|
|
|
|
+ // orderSn: this.option.orderSn,
|
|
|
|
|
+ // payDiscountPrice: res.data.discountAmount
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
payFail() {
|
|
payFail() {
|
|
|
alert('支付失败!')
|
|
alert('支付失败!')
|