mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-24 05:46:04 +08:00
完成优惠券核销功能
This commit is contained in:
parent
ccc127d839
commit
4b82153150
@ -181,4 +181,30 @@ export function getOwnerCommunitys(dataObj) {
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询停车场
|
||||
* @param {Object} dataObj 对象
|
||||
*/
|
||||
export function listParkingAreas(dataObj) {
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
request({
|
||||
url: url.listParkingAreas,
|
||||
method: "GET",
|
||||
data: dataObj,
|
||||
//动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
let _parkingAreas = res.data.parkingAreas;
|
||||
resolve(_parkingAreas);
|
||||
}
|
||||
},
|
||||
fail: function(e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@ -313,10 +313,30 @@ export function receiveParkingCoupon(_objData) {
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function couponPropertyUserGiftCar(_objData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
requestNoAuth({
|
||||
url: url.couponPropertyUserGiftCar,
|
||||
method: "POST",
|
||||
data: JSON.stringify(_objData), //动态数据
|
||||
success: function(res) {
|
||||
if (res.data.code == 0) {
|
||||
//成功情况下跳转
|
||||
resolve(res.data);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function toAliPayTempCarFee(_objData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
requestNoAuth({
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
<view class="line"></view>
|
||||
<view class="money_item" @click="coupons()">
|
||||
<view class="num">{{ka}}</view>
|
||||
<view class="name">卡卷</view>
|
||||
<view class="name">卡劵</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -52,7 +52,10 @@
|
||||
const factory = context.factory; //获取app实例
|
||||
const constant = context.constant;
|
||||
import conf from '@/conf/config.js';
|
||||
import {queryOwnerAccount} from '@/api/user/userApi.js'
|
||||
import {queryOwnerAccount} from '@/api/user/userApi.js';
|
||||
import {
|
||||
getCouponUsers
|
||||
} from '../../api/fee/feeApi.js';
|
||||
export default {
|
||||
name: "my-person",
|
||||
data() {
|
||||
@ -91,6 +94,7 @@
|
||||
_that.userInfo = context.getUserInfo();
|
||||
this.loadOwnerHeaderImg();
|
||||
this.loadOwnerAccount();
|
||||
this.loadOwnerCoupon();
|
||||
},
|
||||
ckeckUserInfo: function() {
|
||||
return context.checkLoginStatus();
|
||||
@ -143,11 +147,11 @@
|
||||
_that.accounts = data;
|
||||
let blanceSum = 0;
|
||||
let interSum = 0;
|
||||
let kaSum = 0;
|
||||
//let kaSum = 0;
|
||||
_that.accounts.forEach((v, k) => {
|
||||
if(v.acctType == '2005'){
|
||||
kaSum += parseFloat(v.amount);
|
||||
}
|
||||
// if(v.acctType == '2005'){
|
||||
// kaSum += parseFloat(v.amount);
|
||||
// }
|
||||
if(v.acctType == '2004'){
|
||||
interSum += parseFloat(v.amount);
|
||||
}
|
||||
@ -157,12 +161,36 @@
|
||||
})
|
||||
_that.blance = blanceSum.toFixed(2);
|
||||
_that.inter = interSum.toFixed(2);
|
||||
_that.ka = kaSum.toFixed(2);
|
||||
//_that.ka = kaSum.toFixed(2);
|
||||
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
loadOwnerCoupon: function() {
|
||||
let _that = this;
|
||||
let _count = 0;
|
||||
_that.ka = 0;
|
||||
context.getOwner(function(_ownerInfo) {
|
||||
if (_ownerInfo) {
|
||||
getCouponUsers({
|
||||
page: 1,
|
||||
row: 100,
|
||||
tel: _ownerInfo.link,
|
||||
communityId: _ownerInfo.communityId,
|
||||
state: '1001'
|
||||
}, null)
|
||||
.then((_couponList) => {
|
||||
_couponList.data.forEach(items => {
|
||||
if (items.isExpire == 'Y') {
|
||||
_count += parseInt(items.stock)
|
||||
}
|
||||
})
|
||||
_that.ka = _count;
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
showLongModel: function() {
|
||||
this.vc.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
|
||||
@ -171,7 +171,11 @@ export default {
|
||||
listInspectionTaskDetails:baseUrl +"app/inspectionTaskDetail.listInspectionTaskDetails",
|
||||
// 优惠券核销二维码生成
|
||||
generatorCouponQrcode:baseUrl +"app/couponProperty.generatorCouponQrcode",
|
||||
computePayFeeCoupon:baseUrl +"app/coupon.computePayFeeCoupon",
|
||||
computePayFeeCoupon:baseUrl +"app/coupon.computePayFeeCoupon",
|
||||
//查询停车场
|
||||
listParkingAreas:baseUrl+"app/parkingArea.listParkingAreas",
|
||||
couponPropertyUserGiftCar:baseUrl+"app/couponProperty.couponPropertyUserGiftCar",
|
||||
|
||||
|
||||
NEED_NOT_LOGIN_PAGE: [
|
||||
'pages/login/login',
|
||||
|
||||
@ -646,6 +646,15 @@
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "pages/coupon/giftParkingCoupon",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "送停车券",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#272636",
|
||||
|
||||
114
pages/coupon/giftParkingCoupon.vue
Normal file
114
pages/coupon/giftParkingCoupon.vue
Normal file
@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="cu-form-group margin-top-sm">
|
||||
<view class="title">车牌号</view>
|
||||
<input placeholder="请输入车牌号" class="text-right" v-model="carNum"></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">停车场</view>
|
||||
<picker @change="parkingAreaChange" :value="paIdIndex" :range="parkingAreas" :range-key="'num'">
|
||||
<view class="picker">
|
||||
{{paIdIndex > -1 ? paNum:'请选择停车场'}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="cu-form-group margin-top-sm">
|
||||
<view class="title">优惠券</view>
|
||||
<input placeholder="请输入优惠券" class="text-right" disabled="disabled" v-model="couponName"></input>
|
||||
</view>
|
||||
<view class="cu-form-group margin-top-sm">
|
||||
<view class="title">赠送数量</view>
|
||||
<input placeholder="请输入赠送数量" class="text-right" type="number" v-model="giftCount"></input>
|
||||
</view>
|
||||
<view class="padding">
|
||||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="_saveCustomCoupon()" type="">赠送</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getCommunityId,listParkingAreas} from '@/api/community/communityApi.js';
|
||||
import {couponPropertyUserGiftCar} from '@/api/fee/feeApi.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
carNum:'',
|
||||
couponName:'',
|
||||
couponId:'',
|
||||
giftCount:1,
|
||||
paId:'',
|
||||
parkingAreas:[],
|
||||
paIdIndex:'-1',
|
||||
paNum:''
|
||||
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.couponName = options.couponName;
|
||||
this.couponId = options.couponId;
|
||||
this._loadParkingArea();
|
||||
},
|
||||
methods:{
|
||||
_loadParkingArea:function(){
|
||||
let _that = this;
|
||||
listParkingAreas({
|
||||
page:1,
|
||||
row:100,
|
||||
communityId:getCommunityId()
|
||||
}).then(_data=>{
|
||||
_that.parkingAreas = _data;
|
||||
})
|
||||
},
|
||||
parkingAreaChange(e) {
|
||||
this.paIdIndex = e.detail.value;
|
||||
this.paNum = this.parkingAreas[this.paIdIndex].num;
|
||||
this.paId = this.parkingAreas[this.paIdIndex].paId;
|
||||
},
|
||||
_saveCustomCoupon:function(){
|
||||
if(!this.carNum){
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:'未填写车牌'
|
||||
});
|
||||
return ;
|
||||
}
|
||||
|
||||
if(!this.couponId){
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:'未选择停车劵'
|
||||
});
|
||||
return ;
|
||||
}
|
||||
|
||||
let _data = {
|
||||
communityId:getCommunityId(),
|
||||
carNum:this.carNum,
|
||||
couponId:this.couponId,
|
||||
giftCount:this.giftCount,
|
||||
paId:this.paId
|
||||
}
|
||||
|
||||
couponPropertyUserGiftCar(_data).then(_msg=>{
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:'赠送成功'
|
||||
});
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
})
|
||||
},err=>{
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:err
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@ -16,7 +16,7 @@
|
||||
<image :src="couponImg" class="coupon"></image>
|
||||
<view class="box">
|
||||
<view class="descripe">
|
||||
<view class="shop-name">{{ item.couponName }}</view>
|
||||
<view class="shop-name">{{ item.couponName }}({{item.stock}}张)</view>
|
||||
<view class="text">{{ item.value }}</view>
|
||||
<view class="expire">{{ item.createTime }}-{{ item.endTime+' 前' }}</view>
|
||||
</view>
|
||||
@ -29,9 +29,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 已使用 -->
|
||||
<view v-for="(itemsData, i) in list" :key="i">
|
||||
<view class="list expired" v-if="active==1">
|
||||
<view class="listItem" v-for="(item, index) in couponList" :key="index">
|
||||
<view class="listItem" v-for="(item, index) in useCouponList" :key="index">
|
||||
<image :src="couponImg" class="coupon"></image>
|
||||
<view class="box">
|
||||
<view class="descripe">
|
||||
@ -40,12 +39,11 @@
|
||||
<view class="expire">{{ item.createTime }}-{{ item.endTime+'00:00' }}</view>
|
||||
</view>
|
||||
<view class="usestate" >
|
||||
您已使用过此优惠券。
|
||||
已使用
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 已过期 -->
|
||||
<view class="list expired" v-if="active==2">
|
||||
<view >
|
||||
@ -58,7 +56,7 @@
|
||||
<view class="expire">{{ item.createTime }}-{{ item.endTime+'00:00' }}</view>
|
||||
</view>
|
||||
<view class="usestate">
|
||||
已过期,无法使用。
|
||||
已过期
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -130,7 +128,8 @@
|
||||
row: 30,
|
||||
tel: context.getUserInfo().link,
|
||||
communityId:getCommunityId(),
|
||||
state: '1001'
|
||||
state: '1001',
|
||||
isStart:'Y'
|
||||
}
|
||||
_that.couponList = [];
|
||||
_that.tmpCouponList = [];
|
||||
@ -182,18 +181,21 @@
|
||||
});
|
||||
},
|
||||
_toQrCode:function(_coupon){
|
||||
|
||||
if(_coupon.toType == '2002'){
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:'请到缴费抵消'
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if(_coupon.toType == '1001' || _coupon.toType == '1011'){
|
||||
}else if(_coupon.toType == '1001' || _coupon.toType == '1011'){
|
||||
uni.navigateTo({
|
||||
url:'/pages/coupon/goodsCoupon?couponId='+_coupon.couponId
|
||||
})
|
||||
}else if(_coupon.toType == '4004'){
|
||||
uni.navigateTo({
|
||||
url:'/pages/coupon/giftParkingCoupon?couponId='+_coupon.couponId+"&couponName="+_coupon.couponName
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user