|
|
@@ -30,9 +30,10 @@
|
|
|
</block>
|
|
|
<block v-if="pageStatus == 1 || pageStatus == 2">
|
|
|
<div class="call-one-btn">
|
|
|
- <button v-if="isYeBtnShow" class="button-com red pay-ye" @click="balancePayFn">余额支付</button>
|
|
|
- <button v-if="getPayType == 1" class="button-com green pay-wx" @click="wxPayFn">微信支付</button>
|
|
|
- <button v-else class="button-com green pay-wx" @click="wxPayFnOld">微信支付</button>
|
|
|
+ <view v-if="Number(hdInfo.balance)>0" style="color:green;font-weight:bold;font-size:36upx;margin-top:28upx;">可用余额 ¥{{ parseFloat(hdInfo.balance) }}</view>
|
|
|
+ <button v-if="isYeBtnShow" class="button-com green pay-wx" @click="balancePayFn" style="height:100upx;line-height:50upx;">余额支付</button>
|
|
|
+ <button v-if="getPayType == 1" class="button-com green pay-wx" @click="wxPayFn" style="height:100upx;line-height:50upx;">微信支付</button>
|
|
|
+ <button v-else class="button-com green pay-wx" @click="wxPayFnOld" style="height:100upx;line-height:50upx;">微信支付</button>
|
|
|
</div>
|
|
|
</block>
|
|
|
<block v-else-if="pageStatus == 3 || pageStatus == 4 || pageStatus == 5">
|
|
|
@@ -49,22 +50,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <modal-module :show="passwordModal" @cancel="modalCancel" @click="passwordModalClick" :maskClosable="false" title="支付密码" padding="30upx 30upx" >
|
|
|
- <template v-slot:content>
|
|
|
- <div class="app-modal-input-wrap">
|
|
|
- <div class="inp-list-line">
|
|
|
- <div class="line-input">
|
|
|
- <input type="password" v-model="form.payPassword" :adjust-position="false" class="inp-input" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </modal-module>
|
|
|
- <alert-module :show="setPassModal" btnText="去设置" btnColor="#FF2842" padding="66upx 24upx 66upx 24upx" @click="hideAlert" >
|
|
|
- <div class="go-login-module">
|
|
|
- <div>请先设置密码</div>
|
|
|
- </div>
|
|
|
- </alert-module>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -75,6 +60,7 @@ import wexinPay from "@/utils/pay/wxPay";
|
|
|
import { getShopUser } from "@/utils/auth";
|
|
|
import { balancePay, wxPay } from "@/api/order";
|
|
|
import { postWxCode } from '@/api/mini';
|
|
|
+import { getHdInfo } from '@/api/hd';
|
|
|
export default {
|
|
|
name: "index",
|
|
|
components: {
|
|
|
@@ -98,7 +84,9 @@ export default {
|
|
|
totalPrice:0,
|
|
|
orderSn:'',
|
|
|
getPayType:1,
|
|
|
- hasRequestApi:false
|
|
|
+ hasRequestApi:false,
|
|
|
+ hdInfo:{},
|
|
|
+ isYeBtnShow:false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -122,27 +110,22 @@ export default {
|
|
|
this.payDiscountPrice = this.option.payDiscountPrice;
|
|
|
this.payDiscountType = this.option.payDiscountType;
|
|
|
this.initClass(this.pageStatus);
|
|
|
- getShopUser(true);
|
|
|
- },
|
|
|
- _balancePay() {
|
|
|
- if (!this.form.payPassword) {
|
|
|
- this.$msg("请先输入支付密码!");
|
|
|
- return false;
|
|
|
+ getShopUser(true)
|
|
|
+
|
|
|
+ if(this.option.hdId && this.option.hdId>0){
|
|
|
+ getHdInfo({id:this.option.hdId}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.hdInfo = res.data.hd ? res.data.hd : {}
|
|
|
+ if(Number(this.hdInfo.balance) >= Number(this.totalPrice)){
|
|
|
+ this.isYeBtnShow = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- balancePay({
|
|
|
- payPassword: this.form.payPassword,
|
|
|
- orderSn: this.orderSn,
|
|
|
- couponId: this.option.couponId
|
|
|
- }).then(res => {
|
|
|
- this.modalCancel();
|
|
|
- this.$msg("支付成功!");
|
|
|
- this.payCallData = res.data;
|
|
|
- this.paySuccess();
|
|
|
- })
|
|
|
+
|
|
|
},
|
|
|
wxPayFn() {
|
|
|
let that = this
|
|
|
-
|
|
|
//解决重复提交问题
|
|
|
if(this.hasRequestApi == true){
|
|
|
this.$msg('正在请求,请5秒后重试')
|
|
|
@@ -194,24 +177,15 @@ export default {
|
|
|
payFail() {
|
|
|
},
|
|
|
balancePayFn() {
|
|
|
- if (this.shopUser.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 = "";
|
|
|
+ let that = this
|
|
|
+ that.$util.confirmModal({content:'确认支付?'},() => {
|
|
|
+ balancePay({orderSn:this.orderSn}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
- // 暂未设置密码
|
|
|
hideAlert() {
|
|
|
this.$util.pageTo("/pages/user/password");
|
|
|
},
|