|
@@ -41,7 +41,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script type="es6">
|
|
|
+<script>
|
|
|
+ import {mapState, mapActions} from 'vuex'
|
|
|
import {Group, Cell} from 'vux'
|
|
|
import axios from 'axios'
|
|
|
import qs from 'qs'
|
|
@@ -59,7 +60,13 @@
|
|
|
components: {
|
|
|
Group, Cell
|
|
|
},
|
|
|
- beforeCreate () {},
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ rechargeList: state => state.rechargeList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ beforeCreate () {
|
|
|
+ },
|
|
|
created () {
|
|
|
// console.log(this.rechargeLists)
|
|
|
},
|
|
@@ -82,6 +89,9 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapActions([
|
|
|
+ 'RECHARGELIST'
|
|
|
+ ]),
|
|
|
btnRechargeList (item, index) {
|
|
|
if (index !== 4) {
|
|
|
this.otherAmount = ''
|
|
@@ -94,15 +104,44 @@
|
|
|
this.rechargeItem = item
|
|
|
},
|
|
|
btnRecharge () {
|
|
|
- console.log(this.isShow)
|
|
|
-// console.log(this.rechargeItem.denomination)
|
|
|
-// let addRechargeorder = {
|
|
|
-// user_id: config.userId,
|
|
|
-// value:
|
|
|
-// }
|
|
|
-// axios.post('o2o/recharge/addRechargeorder',qs.stringify()).then(res => {
|
|
|
-// console.log(res)
|
|
|
-// })
|
|
|
+ // 选择充值类型
|
|
|
+ if (this.rechargeItem.id === undefined) {
|
|
|
+ // 弹出提示框
|
|
|
+ this.otherAmount = ''
|
|
|
+ this.$vux.alert.show({
|
|
|
+ title: '金额错误',
|
|
|
+ content: '请您先选择充值金额'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.rechargeItem.denomination === 1 && this.otherAmount === '') {
|
|
|
+ // 弹出提示框
|
|
|
+ this.otherAmount = ''
|
|
|
+ this.$vux.alert.show({
|
|
|
+ title: '重新输入',
|
|
|
+ content: '请输入您需要充值的金额'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let addRechargeOrder = {
|
|
|
+ user_id: config.userId,
|
|
|
+ value: this.otherAmount,
|
|
|
+ recharge_id: this.rechargeItem.id
|
|
|
+ }
|
|
|
+ let payRecharge = {}
|
|
|
+ axios.post('o2o/recharge/addRechargeorder', qs.stringify(addRechargeOrder)).then(res => {
|
|
|
+ console.log(res.data.success)
|
|
|
+ if (res.data.success) {
|
|
|
+ this.$router.push({path: '/pay'})
|
|
|
+ }
|
|
|
+ payRecharge = {
|
|
|
+ user_id: config.userId,
|
|
|
+ pay_channel: 'wx_pub',
|
|
|
+ order_id: res.data.data._id.$id
|
|
|
+ }
|
|
|
+ console.log(payRecharge)
|
|
|
+ })
|
|
|
+
|
|
|
// axios 1.创建充值卡订单 user_id: user.id, value:inputVal,
|
|
|
// 第二步
|
|
|
},
|