完成积分核销

This commit is contained in:
java110 2022-12-14 00:10:17 +08:00
parent 45dc688bf9
commit d7f3f2ff7c
7 changed files with 417 additions and 1 deletions

View File

@ -52,4 +52,71 @@ export function listCouponPropertyUserDetail(_that,_data){
}
})
});
}
export function getIntegralSetting(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.listIntegralSetting,
data:_data,
success: function(res) {
if(res.data.code != 0){
reject(res.data.msg);
return ;
}
reslove(res.data);
},
fail: function(e) {
reject(e);
}
})
});
}
export function useIntegral(_that,_data){
return new Promise(function(reslove,reject){
// debugger
_that.context.post({
url: url.useIntegral,
data:_data,
success: function(res) {
if (res.data.code == 0){
reslove(res);
}else {
// debugger
wx.showToast({
title: "核销状态:" + res.data.msg,
icon: 'none',
duration: 3000
})
}
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 3000
})
}
})
});
}
export function getIntegralUserDetail(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.listIntegralUserDetail,
data:_data,
success: function(res) {
if(res.data.code != 0){
reject(res.data.msg);
return ;
}
reslove(res.data);
},
fail: function(e) {
reject(e);
}
})
});
}

45
api/owner/owner.js Normal file
View File

@ -0,0 +1,45 @@
import url from '../../constant/url.js';
export function queryOwners(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.queryOwners,
data:_data,
success: function(res) {
reslove(res.data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
})
});
}
export function queryOwnerAccount(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.queryOwnerAccount,
data:_data,
success: function(res) {
if(res.data.code == 0){
reslove(res.data);
}else{
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
})
});
}

View File

@ -0,0 +1,72 @@
<template>
<view>
<view v-if="orders && orders.length>0">
<view v-for="(item,index) in orders" :key="index"
class="bg-white margin-top margin-right-xs radius margin-left-xs padding">
<view class="flex padding-bottom-xs solid-bottom justify-between">
<view style="font-size: 14px;">单号<span style="margin-left: 10px;"
class="text-gray">{{item.uoId}}</span></view>
</view>
<view class="flex margin-top justify-between">
<view class="text-gray">账户</view>
<view class="text-gray">{{item.acctName}}</view>
</view>
<view class="flex margin-top justify-between">
<view class="text-gray">抵扣积分/金额</view>
<view class="text-gray">{{item.useQuantity}}个积分/{{item.money}}</view>
</view>
<view class="flex margin-top-xs justify-between">
<view class="text-gray">核销人</view>
<view class="text-gray">{{item.userName}}({{item.tel}})</view>
</view>
<view class="flex margin-top-xs justify-between">
<view class="text-gray">核销时间</view>
<view class="text-gray">{{item.createTime}}</view>
</view>
<view class="flex margin-top-xs justify-between">
<view class="text-gray">说明</view>
<view class="text-gray">{{item.remark }}</view>
</view>
</view>
</view>
<view v-else>
<no-data-page></no-data-page>
</view>
</view>
</template>
<script>
import noDataPage from '@/components/no-data-page/no-data-page.vue';
import {
getCurrentCommunity
} from '../../api/community/community.js';
import {getIntegralUserDetail}
from '../../api/coupon/coupon.js'
export default {
name:"useIntegralLog",
data() {
return {
orders:[]
};
},
created() {
//this.loadUseIntegral();
},
methods:{
loadIntegralUserDetail:function(){
let _that = this;
getIntegralUserDetail(this,{
page:1,
row:100,
communityId: getCurrentCommunity().communityId
}).then(_data=>{
_that.orders = _data.data;
})
}
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,156 @@
<template>
<view>
<view class="cu-form-group margin-top-sm">
<view class="title">手机号</view>
<input placeholder="请输入手机号" class="text-right" @blur="_changeTel()" v-model="tel"></input>
</view>
<view class="cu-form-group">
<view class="title">业主</view>
<picker @change="ownerIndexChange" :value="ownerIndex" :range="owners" :range-key="'name'">
<view class="picker">
{{ownerIndex > -1 ? ownerName:'请选择业主'}}
</view>
</picker>
</view>
<view class="cu-form-group margin-top-sm">
<view class="title">积分账号</view>
<text>{{acctName}}</text>
</view>
<view class="cu-form-group margin-top-sm">
<view class="title">积分数</view>
<text>{{quantity}}</text>
</view>
<view class="cu-form-group margin-top-sm">
<view class="title">核销金额</view>
<input placeholder="请输入核销金额" class="text-right" @blur="_computeUseQuantity()" v-model="useMoney"></input>
</view>
<view class="cu-form-group margin-top-sm">
<view class="title">核销积分</view>
<text>{{useQuantity}}</text>
</view>
<view class="cu-form-group margin-top-sm">
<view class="title">核销说明</view>
<textarea placeholder="请输入核销说明" v-model="remark"></textarea>
</view>
<view class="padding">
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="_useIntegralOrder()" type="">核销</button>
</view>
</view>
</template>
<script>
import {
getIntegralSetting,
useIntegral
} from '../../api/coupon/coupon.js';
import {
getCurrentCommunity
} from '../../api/community/community.js';
import {
queryOwners,
queryOwnerAccount
} from '../../api/owner/owner.js'
export default {
name: "useIntegral",
data() {
return {
tel: '',
ownerId: '',
ownerName: '',
acctId: '',
acctName: '',
quantity: 0,
useMoney: '',
useQuantity: '',
remark: '',
owners: [],
money: 0,
ownerIndex: -1,
};
},
created() {
this._loadIntegralSetting();
},
methods: {
ownerIndexChange: function(e) {
this.ownerIndex = e.detail.value;
this.ownerName = this.owners[this.ownerIndex].name;
this.ownerId = this.owners[this.ownerIndex].ownerId;
if (this.ownerId) {
this._loadAccount();
}
},
_loadIntegralSetting: function() {
let _that = this;
getIntegralSetting(this, {
page: 1,
row: 1,
communityId: getCurrentCommunity().communityId
}).then(_data => {
_that.money = _data.data[0].money;
})
},
_changeTel: function() {
if (!this.tel) {
return;
}
let _that = this;
queryOwners(this, {
page: 1,
row: 100,
communityId: getCurrentCommunity().communityId,
link: this.tel,
ownerTypeCd: '1001'
}).then(_data => {
_that.owners = _data.owners;
})
},
_loadAccount: function() {
let _that = this;
queryOwnerAccount(this, {
page: 1,
row: 1,
communityId: getCurrentCommunity().communityId,
objId: this.ownerId,
acctType: '2004'
}).then(_data => {
_that.acctId = _data.data[0].acctId;
_that.acctName = _data.data[0].acctName;
_that.quantity = _data.data[0].amount;
})
},
_computeUseQuantity: function() {
let _quantity = parseFloat(this.useMoney) / parseFloat(this.money);
this.useQuantity = Math.ceil(_quantity);
},
_useIntegralOrder: function() {
useIntegral(this, {
acctId: this.acctId,
useMoney: this.useMoney,
remark: this.remark,
communityId: getCurrentCommunity().communityId,
}).then(_data => {
uni.showToast({
icon: 'none',
title: '核销成功'
});
this.tel = '';
this.ownerId = '';
this.ownerName = '';
this.acctId = '';
this.acctName = '';
this.quantity = 0;
this.useMoney = '';
this.useQuantity = '';
this.remark = '';
this.owners = [];
this.ownerIndex = -1;
})
}
}
}
</script>
<style>
</style>

View File

@ -179,7 +179,16 @@ export default {
saveCommunitySpaceConfirmOrder: baseUrl + "app/communitySpace.saveCommunitySpaceConfirmOrder",
queryReportStaffInspection: baseUrl+"app/inspection.queryReportStaffInspection",
listCouponPropertyUserDetail: baseUrl+"app/couponProperty.listCouponPropertyUserDetail",
writeOffCouponPropertyUser: baseUrl+"app/couponProperty.writeOffCouponPropertyUser"
writeOffCouponPropertyUser: baseUrl+"app/couponProperty.writeOffCouponPropertyUser",
listIntegralSetting: baseUrl+"app/integral.listIntegralSetting",
queryOwners: baseUrl+"app/owner.queryOwners",
queryOwnerAccount: baseUrl+"app/account/queryOwnerAccount",
useIntegral: baseUrl+"app/integral.useIntegral",
listIntegralUserDetail: baseUrl+"app/integral.listIntegralUserDetail",

View File

@ -569,6 +569,15 @@
}
}
,{
"path" : "pages/coupon/writeOffIntegral",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",

View File

@ -0,0 +1,58 @@
<template>
<view>
<scroll-view scroll-x class="bg-white nav">
<view class="flex text-center">
<view class="cu-item flex-sub" :class="active==0?'text-green cur':''" @tap="tabSelect(0)">
积分核销
</view>
<view class="cu-item flex-sub" :class="active==1?'text-green cur':''" @tap="tabSelect(1)">
核销记录
</view>
</view>
</scroll-view>
<view v-if="active == 0">
<use-integral></use-integral>
</view>
<view v-show="active == 1">
<use-integral-log ref="useIntegralLogRef"></use-integral-log>
</view>
</view>
</template>
<script>
import useIntegral from '../../components/coupon/use-integral';
import useIntegralLog from '../../components/coupon/use-integral-log.vue'
export default {
data() {
return {
active: 0,
};
},
onLoad: function(options) {
},
components:{
useIntegral,
useIntegralLog
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
methods: {
tabSelect: function(_active) {
this.active = _active;
if(this.active == 1){
this.$refs.useIntegralLogRef.loadIntegralUserDetail();
}
},
}
};
</script>
<style>
</style>