|
|
@@ -16,9 +16,9 @@
|
|
|
充值
|
|
|
</view>
|
|
|
</view>
|
|
|
- <template v-if="ctype == 2">
|
|
|
+ <template v-if="ctype == 2 || ctype == 3">
|
|
|
<picker @change="bindPickerChange" :value="chooseId" :range="provinces" range-key="label">
|
|
|
- <view class="search-box sf-wrap flex">
|
|
|
+ <view class="search-box sf-wrap flex" v-if="ctype == 3">
|
|
|
<view class="">
|
|
|
省份
|
|
|
</view>
|
|
|
@@ -26,34 +26,56 @@
|
|
|
</view>
|
|
|
|
|
|
</picker>
|
|
|
+ <view class="search-box sf-wrap flex" v-if="ctype == 2">
|
|
|
+ <view class="">
|
|
|
+ 省市
|
|
|
+ </view>
|
|
|
+ <view class="" style="width: 150px;height: 100%;text-align: right;">
|
|
|
+ <qiaoSelect :keyId="1" :dataList="dataList" phText="选择省市" phColor="#999999" showField="name" searchKey="name"
|
|
|
+ :showObj="showObj" :showBorder="false" :disabled="false" @change="selectChange" @input='inputChange'></qiaoSelect>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="search-box sf-wrap flex">
|
|
|
<view class="">
|
|
|
姓名
|
|
|
</view>
|
|
|
- <input type="text" placeholder="请输入户主姓名" class="name-inp" v-model="userName"/>
|
|
|
+ <input type="text" placeholder="请输入户主姓名" class="name-inp" v-model="userName" />
|
|
|
</view>
|
|
|
<!-- 户号 -->
|
|
|
<view class="search-box sf-wrap flex">
|
|
|
<view class="">
|
|
|
户号
|
|
|
</view>
|
|
|
- <input type="text" placeholder="请输入户号" class="name-inp" v-model="rechargeno"/>
|
|
|
+ <input type="text" placeholder="请输入户号" class="name-inp" v-model="rechargeno" />
|
|
|
+ </view>
|
|
|
+ <view class="search-box sf-wrap flex" v-if="ctype == 3">
|
|
|
+ <view class="">
|
|
|
+ 金额
|
|
|
+ </view>
|
|
|
+ <input type="text" placeholder="请输入充值金额" class="name-inp" v-model="sbjzt" />
|
|
|
+ </view>
|
|
|
+ <!-- jfjg -->
|
|
|
+ <view class="search-box sf-wrap flex" v-if="ctype == 3">
|
|
|
+ <view class="">
|
|
|
+ 缴费机构
|
|
|
+ </view>
|
|
|
+ <input type="text" placeholder="请输入缴费机构" class="name-inp" v-model="jfjg" />
|
|
|
</view>
|
|
|
</template>
|
|
|
-
|
|
|
- <view class='search-box sf-wrap flex'>
|
|
|
+
|
|
|
+ <view class='search-box sf-wrap flex' v-if="userInfo.integral > 0">
|
|
|
<view>积分抵扣</view>
|
|
|
<view class='discount acea-row row-middle'>
|
|
|
<view style="margin-right: 10rpx;"> 当前积分
|
|
|
<text class='num font-color'>{{userInfo.integral || 0}}</text>
|
|
|
</view>
|
|
|
<view class="cb" @click="changeUseIntegral">
|
|
|
- <view v-show="useIntegral" class="cb-in" >
|
|
|
+ <view v-show="useIntegral" class="cb-in">
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="item-wrap" v-for="item in info">
|
|
|
+ <view v-if="ctype != 3" class="item-wrap" v-for="item in info">
|
|
|
<view class="tit">
|
|
|
{{item.cname}}
|
|
|
</view>
|
|
|
@@ -78,7 +100,7 @@
|
|
|
</template>
|
|
|
|
|
|
</view>
|
|
|
- <view class="item-wrap" v-if="content && ctype != 2 && info.length > 0">
|
|
|
+ <view class="item-wrap" v-if="content && ctype == 1 && info.length > 0">
|
|
|
<view class="tit">
|
|
|
注意事项
|
|
|
</view>
|
|
|
@@ -112,18 +134,20 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
- <payment :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice"
|
|
|
+ <payment :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice"
|
|
|
@changePayType="changePayType" @onChangeFun="onChangeFun"></payment>
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import qiaoSelect from '@/uni_modules/qiao-select/components/qiao-select/qiaoSelect.vue'
|
|
|
import payment from '@/components/payment';
|
|
|
import {
|
|
|
getCzList,
|
|
|
createCz,
|
|
|
- computedCz
|
|
|
+ computedCz,
|
|
|
+ getCity
|
|
|
} from '@/api/three'
|
|
|
import {
|
|
|
getUserInfo
|
|
|
@@ -135,9 +159,13 @@
|
|
|
export default {
|
|
|
components: {
|
|
|
payment,
|
|
|
+ qiaoSelect
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ dataList: [],
|
|
|
+ jfjg: '',
|
|
|
+ sbjzt: 0,
|
|
|
rechargeno: '',
|
|
|
toPay: false,
|
|
|
paying: false,
|
|
|
@@ -152,6 +180,10 @@
|
|
|
{
|
|
|
name: '电费充值',
|
|
|
ctype: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '水费充值',
|
|
|
+ ctype: 3
|
|
|
}
|
|
|
],
|
|
|
useIntegral: false,
|
|
|
@@ -161,7 +193,7 @@
|
|
|
choose: {
|
|
|
goods_id: 0
|
|
|
},
|
|
|
- payType:1,
|
|
|
+ payType: 1,
|
|
|
payName: 'weixin',
|
|
|
userInfo: {},
|
|
|
ctype: 0,
|
|
|
@@ -193,6 +225,7 @@
|
|
|
this.getUserInfo()
|
|
|
this.getCzList()
|
|
|
this.getCityData()
|
|
|
+ this.getCity()
|
|
|
},
|
|
|
onShow() {},
|
|
|
onReachBottom() {
|
|
|
@@ -200,8 +233,41 @@
|
|
|
},
|
|
|
onReady() {
|
|
|
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ sbjzt(n, o) {
|
|
|
+ // if(this.choos)
|
|
|
+ if (n > this.userInfo.integral) {
|
|
|
+ this.useIntegral = false
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ getCity() {
|
|
|
+ getCity().then(res => {
|
|
|
+ console.log(res)
|
|
|
+ let arr = []
|
|
|
+ res.data.forEach((item,index) => {
|
|
|
+ arr.push({
|
|
|
+ name: item,
|
|
|
+ id: index
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.dataList = arr
|
|
|
+ console.log(this.dataList)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectChange(e) {
|
|
|
+ console.log(e,'selectChange')
|
|
|
+ if(e) {
|
|
|
+ this.province = e.name
|
|
|
+ }else {
|
|
|
+ this.province = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ inputChange(e) {
|
|
|
+ console.log(e,'inputChange')
|
|
|
+ },
|
|
|
changePayType(type) {
|
|
|
console.log(type)
|
|
|
// this.payType = type
|
|
|
@@ -219,23 +285,46 @@
|
|
|
getYjList(tip, ctype) {
|
|
|
this.ctype = ctype
|
|
|
this.info = []
|
|
|
+ this.choose = {}
|
|
|
this.getCzList()
|
|
|
},
|
|
|
changeUseIntegral: function() {
|
|
|
- this.useIntegral = !this.useIntegral;
|
|
|
- if(this.choose.goods_id) {
|
|
|
- this.computedPrice();
|
|
|
+ if (this.ctype == 3) {
|
|
|
+ if (!this.sbjzt) {
|
|
|
+ return this.$util.Tips({
|
|
|
+ title: '请输入充值金额'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.sbjzt > this.userInfo.integral) {
|
|
|
+ this.useIntegral = false
|
|
|
+ } else {
|
|
|
+ this.useIntegral = !this.useIntegral
|
|
|
+ this.computedPrice();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.choose.price > this.userInfo.integral) {
|
|
|
+ this.useIntegral = false
|
|
|
+ } else {
|
|
|
+ this.useIntegral = !this.useIntegral
|
|
|
+ }
|
|
|
+ if (this.choose.price) {
|
|
|
+ this.computedPrice();
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
// 计算价格
|
|
|
- computedPrice() {
|
|
|
+ computedPrice(tit) {
|
|
|
computedCz({
|
|
|
- integral: this.useIntegral ? 1: 0,
|
|
|
- price: this.choose.price,
|
|
|
+ integral: this.useIntegral ? 1 : 0,
|
|
|
+ price: this.ctype == 3 ? this.sbjzt : this.choose.price,
|
|
|
uid: this.userInfo.uid
|
|
|
}).then(res => {
|
|
|
this.priceInfo = res.data
|
|
|
this.totalPrice = res.data.payPrice
|
|
|
+ if(tit == 'open') {
|
|
|
+ this.pay_close = true
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
getUserInfo: function() {
|
|
|
@@ -259,6 +348,7 @@
|
|
|
}
|
|
|
},
|
|
|
goCz() {
|
|
|
+
|
|
|
if (!this.phone) {
|
|
|
return this.$util.Tips({
|
|
|
title: '请输入手机号'
|
|
|
@@ -270,12 +360,13 @@
|
|
|
title: '请输入正确的手机号'
|
|
|
});
|
|
|
}
|
|
|
- if (!this.choose.goods_id) {
|
|
|
- return this.$util.Tips({
|
|
|
- title: '请选择需要充值的套餐'
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
if (this.ctype == 2) {
|
|
|
+ if (!this.choose.goods_id) {
|
|
|
+ return this.$util.Tips({
|
|
|
+ title: '请选择需要充值的套餐'
|
|
|
+ });
|
|
|
+ }
|
|
|
if (!this.province) {
|
|
|
return this.$util.Tips({
|
|
|
title: '请选择省份'
|
|
|
@@ -286,7 +377,23 @@
|
|
|
title: '请输入姓名'
|
|
|
});
|
|
|
}
|
|
|
+ } else if (this.ctype == 3) {
|
|
|
+ if(!this.sbjzt) {
|
|
|
+ return this.$util.Tips({
|
|
|
+ title: '请输入充值金额'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(!this.jfjg) {
|
|
|
+ return this.$util.Tips({
|
|
|
+ title: '请输入缴费机构'
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
+ if (!this.choose.goods_id) {
|
|
|
+ return this.$util.Tips({
|
|
|
+ title: '请选择需要充值的套餐'
|
|
|
+ });
|
|
|
+ }
|
|
|
// 校验手机
|
|
|
let phoneType = this.getMobileOperator(this.phone)
|
|
|
if (this.choose.goods_name.indexOf(phoneType) == -1) {
|
|
|
@@ -298,9 +405,12 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if(this.ctype == 3) {
|
|
|
+ this.computedPrice('open')
|
|
|
+ }else {
|
|
|
+ this.pay_close = true
|
|
|
+ }
|
|
|
// this.$refs.popup.open()
|
|
|
- this.pay_close = true
|
|
|
},
|
|
|
getMobileOperator(phoneNumber) {
|
|
|
// 移动号段
|
|
|
@@ -331,32 +441,33 @@
|
|
|
//
|
|
|
console.log(e)
|
|
|
let that = this
|
|
|
- if(e.action == 'payClose') {
|
|
|
+ if (e.action == 'payClose') {
|
|
|
this.pay_close = false
|
|
|
return
|
|
|
- }else {
|
|
|
- if(e.value == 'yue') {
|
|
|
- if(that.priceInfo.payPrice*1 > that.userInfo.now_money) {
|
|
|
+ } else {
|
|
|
+ if (e.value == 'yue') {
|
|
|
+ if (that.priceInfo.payPrice * 1 > that.userInfo.now_money) {
|
|
|
return this.$util.Tips({
|
|
|
title: '当前余额不足'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let qdata = {
|
|
|
- goods_id: this.choose.goods_id,
|
|
|
+ goods_id: this.ctype== 3?"": this.choose.goods_id,
|
|
|
rechargeno: this.phone,
|
|
|
province: this.province,
|
|
|
pay_type: e.value,
|
|
|
+ num: this.ctype == 3? this.sbjzt: this.choose.num,
|
|
|
pay_price: this.priceInfo.payPrice,
|
|
|
store_id: 0,
|
|
|
user_phone: this.phone,
|
|
|
real_name: this.userName,
|
|
|
deduction_price: this.priceInfo.deductionPrice,
|
|
|
deduction_integral: this.priceInfo.usedIntegral,
|
|
|
- cid: this.choose.cid,
|
|
|
- goods_name: this.choose.goods_name,
|
|
|
- type: this.ctype,
|
|
|
+ cid:this.ctype==3?"": this.choose.cid,
|
|
|
+ goods_name:this.ctype==3?this.jfjg: this.choose.goods_name,
|
|
|
+ type: this.ctype == 0? 1: this.ctype,
|
|
|
// #ifdef MP
|
|
|
'from': 'routine',
|
|
|
// #endif
|
|
|
@@ -364,24 +475,24 @@
|
|
|
'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
|
|
|
// #endif
|
|
|
}
|
|
|
- if(this.ctype == 2) {
|
|
|
+ if (this.ctype == 2) {
|
|
|
qdata.rechargeno = this.rechargeno
|
|
|
}
|
|
|
- if(that.paying) {
|
|
|
+ if (that.paying) {
|
|
|
return
|
|
|
}
|
|
|
that.paying = true
|
|
|
createCz(qdata).then(res => {
|
|
|
- setTimeout(()=> {
|
|
|
+ setTimeout(() => {
|
|
|
that.paying = false
|
|
|
that.getUserInfo()
|
|
|
- },2500)
|
|
|
+ }, 2500)
|
|
|
let status = res.data.status,
|
|
|
// orderId = res.data.result.order_id,
|
|
|
jsConfig = res.data.result.jsConfig
|
|
|
- // goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res
|
|
|
- // .msg +
|
|
|
- // '&type=6' + '&totalPrice=' + this.totalPrice + '&pay_type=' + e.value
|
|
|
+ // goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res
|
|
|
+ // .msg +
|
|
|
+ // '&type=6' + '&totalPrice=' + this.totalPrice + '&pay_type=' + e.value
|
|
|
switch (status) {
|
|
|
case 'ORDER_EXIST':
|
|
|
case 'EXTEND_ORDER':
|
|
|
@@ -485,11 +596,11 @@
|
|
|
location.href = res.data.result.jsConfig.mweb_url;
|
|
|
}, 2000);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'ALIPAY_PAY':
|
|
|
//#ifdef H5
|
|
|
if (this.from === 'weixin') {
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
uni.hideLoading();
|
|
|
that.formContent = res.data.result.jsConfig;
|
|
|
@@ -519,7 +630,7 @@
|
|
|
url: url
|
|
|
})
|
|
|
}, 2000)
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
fail: (e) => {
|
|
|
let url = '/pages/goods/order_pay_status/index?order_id=' +
|
|
|
@@ -546,17 +657,24 @@
|
|
|
// #endif
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ }).catch(err => {
|
|
|
+ that.paying = false
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
chooseGood(item) {
|
|
|
this.choose = item
|
|
|
+ if (this.choose.price > this.userInfo.integral) {
|
|
|
+ this.useIntegral = false
|
|
|
+ }
|
|
|
+ // if(this.userInfo)
|
|
|
this.computedPrice()
|
|
|
},
|
|
|
getCzList() {
|
|
|
let that = this
|
|
|
+ if (this.ctype == 3) return
|
|
|
uni.showLoading({
|
|
|
title: '加载中...'
|
|
|
})
|
|
|
@@ -833,6 +951,7 @@
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
+
|
|
|
.cb-in {
|
|
|
width: 20rpx;
|
|
|
height: 20rpx;
|
|
|
@@ -840,6 +959,7 @@
|
|
|
background-color: #1890FF;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.name-inp {
|
|
|
// width: ;
|
|
|
flex-grow: 1;
|