diff --git a/src/subpackage/order/js/api.js b/src/subpackage/order/js/api.js
index 82687cb..186bbf8 100644
--- a/src/subpackage/order/js/api.js
+++ b/src/subpackage/order/js/api.js
@@ -4,7 +4,9 @@ export const ORDER_API = {
venueCourse_orderInfo:`${ORIGIN}/admin/venueCourse/orderInfo`, // 课程订单 - 详情
userValueCardInfo:`${ORIGIN}/admin/userValueCard/get`, // 用户储值卡详情_copy
userValueCardConsumes:`${ORIGIN}/admin/userValueCard/consumes`, // 用户储值卡消费记录_copy
-
+ consumeTypeList:`${ORIGIN}/valueCard/consumeType/list`, // 用户储值卡消费场景列表
+ userValueCardDeduct:`${ORIGIN}/admin/userValueCard/deduct`, // 用户储值卡-扣费_copy
+ userValueCardRecharge:`${ORIGIN}/admin/userValueCard/recharge`, // 用户储值卡-充值_copy
}
export default ORDER_API;
\ No newline at end of file
diff --git a/src/subpackage/order/pages/value_card/detail/detail.vue b/src/subpackage/order/pages/value_card/detail/detail.vue
index 8460b5c..c5fb087 100644
--- a/src/subpackage/order/pages/value_card/detail/detail.vue
+++ b/src/subpackage/order/pages/value_card/detail/detail.vue
@@ -7,13 +7,13 @@
储值卡卡号:{{ orderInfo.card_no || '-' }}
手机号码:{{ orderInfo.mobile || '-' }}
- 储值卡余额:{{ orderInfo.balance || '0' }}
+ 储值卡余额:¥{{ orderInfo.balance || '0' }}
消费记录
- 扣费
- 充值
+ 扣费
+ 充值
@@ -79,15 +79,15 @@
-->
-
-
-
+
+ false">
+
充值
- 储值卡号:20195171564566
- 手机号码:18316553478
- 余额:¥75.25
+ 储值卡号:{{ orderInfo.card_no || '-' }}
+ 手机号码:{{ orderInfo.mobile || '-' }}
+ 余额:¥{{ orderInfo.balance || '0' }}
@@ -95,11 +95,11 @@
*充值金额
-
+
-
+
-
+
元
@@ -108,11 +108,11 @@
*充值赠送金额
-
+
-
+
-
+
元
@@ -121,11 +121,11 @@
*赠送有效期
-
+
-
+
-
+
天
@@ -134,11 +134,11 @@
*延长有效期
-
+
-
+
-
+
天
@@ -146,34 +146,39 @@
- 取消
- 确认
+ 取消
+ 确认
-
-
-
+
+ false" >
+
扣费
- 储值卡号:20195171564566
- 手机号码:18316553478
- 余额:¥75.25
+ 储值卡号:{{ orderInfo.card_no || '-' }}
+ 手机号码:{{ orderInfo.mobile || '-' }}
+ 余额:¥{{ orderInfo.balance || '0' }}
- *充值金额
+ *消费金额
-
+
-
+
-
+
元
@@ -183,22 +188,20 @@
-
+
-
-
+
+
-
-
- 确认
+ 确认
@@ -233,15 +236,111 @@ export default {
},
data(){
return{
+ isDeductModal: false, // 扣费
+ deductAmount: 1, // 扣费金额
+ deductRemark: '', // 扣费备注
+ consumeTypeList: [], // 扣费类型
+ curConsumeType: {}, // 扣费选中类型
+
+ isRechargeModal: false,
+ rechargeInfo: {
+ amount: 0,
+ giveAmount: 0,
+ giveDate: 0,
+ extendDate: 0
+ },
+
orderInfo: {
records: []
- }
+ },
+
+
+
}
},
onLoad(options){
this.getInfo(options.card_no);
+ this.getConsumeTypeList();
},
methods: {
+ rechargeConfirm: util.debounce(function(){
+ let { rechargeInfo, orderInfo } = this;
+ if(rechargeInfo.amount< 0)return util.showNone('充值金额有误!');
+ if(rechargeInfo.giveAmount< 0)return util.showNone('充值赠送金额有误!');
+ if(rechargeInfo.giveDate< 0)return util.showNone('赠送有效期有误!');
+ if(rechargeInfo.extendDate< 0)return util.showNone('延长有效期有误!');
+
+ util.showLoad();
+ server.post({
+ url: ORDER_API.userValueCardRecharge,
+ data: {
+ card_no: orderInfo.card_no,
+ amount: rechargeInfo.amount,
+ day: rechargeInfo.extendDate,
+ gift_amount: rechargeInfo.giveAmount,
+ gift_day: rechargeInfo.giveDate,
+ },
+ isDefaultGet: false,
+ })
+ .then(res => {
+ util.hideLoad();
+ if(res.data.code == 0){
+ this.refreshThis();
+ util.showNone(res.data.message || '操作成功!');
+ }else{
+ util.showNone(res.data.message || '操作失败!');
+ }
+ })
+ .catch(util.hideLoad)
+
+
+ }, 300, true),
+ refreshThis(){
+ this.isDeductModal = false;
+ this.deductAmount = 1;
+ this.deductRemark = '';
+ this.curConsumeType = {};
+
+ this.isRechargeModal = false;
+ this.rechargeInfo['amount'] = 0;
+ this.rechargeInfo['giveAmount'] = 0;
+ this.rechargeInfo['giveDate'] = 0;
+ this.rechargeInfo['extendDate'] = 0;
+
+ let { orderInfo } = this;
+ this.getInfo(orderInfo.card_no);
+
+ },
+ consumeTypePickerChange(e){
+ let { consumeTypeList } = this;
+ this.curConsumeType = consumeTypeList[e.detail.value];
+ },
+ deductConfirmBtn: util.debounce(function(){
+ let { deductAmount, deductRemark, curConsumeType, orderInfo } = this;
+ if(deductAmount<0)return util.showNone('扣除价格有误!');
+ util.showLoad();
+ server.post({
+ url: ORDER_API.userValueCardDeduct,
+ data: {
+ consume_type: curConsumeType.consume_type,
+ desc: deductRemark,
+ card_no: orderInfo.card_no,
+ amount: deductAmount,
+ },
+ isDefaultGet: false,
+ })
+ .then(res => {
+ util.hideLoad();
+ if(res.data.code == 0){
+ this.refreshThis();
+ util.showNone(res.data.message || '操作成功!');
+ }else{
+ util.showNone(res.data.message || '操作失败!');
+ }
+ })
+ .catch(util.hideLoad)
+
+ }, 300, true),
toRecord(){
let { orderInfo } = this;
util.routeTo(`/subpackage/order/pages/value_card/xpense_tracker/xpense_tracker?card_no=${orderInfo.card_no}`, 'nT');
@@ -263,6 +362,16 @@ export default {
2: '充值',
}
return _obj[order_way] || '-'
+ },
+ getConsumeTypeList(){
+ server.get({
+ url: ORDER_API.consumeTypeList,
+ data: {},
+ failMsg: '加载失败!'
+ })
+ .then(res=>{
+ this.consumeTypeList = res || {};
+ })
}
}
}
@@ -382,7 +491,6 @@ export default {
top: 30upx;
width: 34upx;
height: 34upx;
- background-color: skyblue;
}
.vr-tit{
margin-bottom: 34upx;
@@ -528,7 +636,7 @@ export default {
width: 32upx;
height: 32upx;
margin-left: 20upx;
- background-color: skyblue;
+ transform: rotateZ(90deg);
}
}
.vi-remark{
diff --git a/src/subpackage/order/pages/value_card/xpense_tracker/xpense_tracker.vue b/src/subpackage/order/pages/value_card/xpense_tracker/xpense_tracker.vue
index 2ab5fd7..9c77fcd 100644
--- a/src/subpackage/order/pages/value_card/xpense_tracker/xpense_tracker.vue
+++ b/src/subpackage/order/pages/value_card/xpense_tracker/xpense_tracker.vue
@@ -2,9 +2,9 @@
@@ -44,39 +45,100 @@ import util from '../../../../../utils/util';
import { ORDER_API } from '../../../js/api';
import server from '../../../js/server';
export default {
+ computed: {
+ dateList(){
+ let _arr = [];
+ let _startYear = 1970;
+ let _yearLength = 131;
+
+ _arr[0] = new Array(_yearLength).fill(1).map((e, i)=> ({ num: _startYear + i, str: `${ _startYear + i }年` }));
+ _arr[1] = new Array(12).fill(1).map((e, i)=> ({ num: i+1, str: `${util.formatNumber(i+1)}月` }))
+ return _arr;
+ },
+ // 首次加载定位当前月份
+ curDateKey(){
+ let { dateList } =this;
+ let _curYear = new Date().getFullYear();
+ let _curMonth = new Date().getMonth() + 1;
+ return [dateList[0].findIndex(e=> e.num == _curYear), dateList[1].findIndex(e=> e.num == _curMonth)]
+ },
+ // 选中展示日期
+ showDateStr(){
+ let { dateValue, dateList } = this;
+ if(!dateValue || !dateValue.length)return '';
+ return `${dateList[0][dateValue[0]].str}-${dateList[1][dateValue[1]].str}`
+ },
+ // 请求日期格式
+ reqDateStr(){
+ let { dateValue, dateList } = this;
+ if(!dateValue || !dateValue.length)return '';
+ return `${dateList[0][dateValue[0]].num}-${util.formatNumber(dateList[1][dateValue[1]].num)}`
+ }
+ },
data(){
return {
recordList: [],
- card_no: ''
+ card_no: '',
+ dateValue: [],
+ consume: '',
+ page: 1
}
},
+ onReachBottom(){
+ let { consume, card_no, reqDateStr, page } = this;
+ this.getList({
+ card_no: card_no,
+ consume: consume,
+ date: reqDateStr,
+ page: ++page,
+ })
+ },
onLoad(options){
let _card_no = options.card_no || '';
this.card_no = _card_no;
- this.getList({ card_no: _card_no })
+ this.getList({ card_no: _card_no });
},
methods: {
- getList({ card_no, consume_type = '', date = '' }){
+ refreshList(){
+ let { consume, card_no, reqDateStr } = this;
+ this.page = 1;
+ this.recordList = [];
+ this.getList({
+ card_no: card_no,
+ consume: consume,
+ date: reqDateStr,
+ })
+ },
+ datePickerChange(e){
+ this.dateValue = e.detail.value;
+ this.$nextTick(this.refreshList);
+ },
+ getList({ card_no, consume = '', date = '', page = 1, page_size = 20 }){
util.showLoad();
server.get({
url: ORDER_API.userValueCardConsumes,
- data: { card_no, consume_type, date },
+ data: { card_no, consume, month: date, page, page_size },
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _list = res.consumes || [];
- this.recordList = _list;
+ if(page == 1)return this.recordList = _list;
+ if(!_list.length)return util.showNone('没有更多!');
+ this.page = page;
+ this.recordList = [ ...this.recordList, ..._list ];
})
},
filtrateBtn(){
uni.showActionSheet({
itemList: ['支出', '收入'],
success: aRes=>{
- let _type = aRes.tapIndex + 1;
- let { card_no } = this;
- this.getList({ card_no, consume_type: _type })
- console.warn(aRes)
+ let _type = aRes.tapIndex == 0 ? 'outcome' : aRes.tapIndex == 1 ? 'income' : '';
+ this.consume = _type;
+ this.$nextTick(this.refreshList);
+ // let { card_no } = this;
+ // this.getList({ card_no, consume_type: _type });
+ // console.warn(aRes)
}
})
}
diff --git a/src/subpackage/order/static/images/value_card/close.png b/src/subpackage/order/static/images/value_card/close.png
new file mode 100644
index 0000000..78ab5f4
Binary files /dev/null and b/src/subpackage/order/static/images/value_card/close.png differ