Commit e7a1cca4 authored by 黄奎's avatar 黄奎

11

parent bf0c39da
......@@ -209,7 +209,7 @@
that.apipost("LvXiaoYou_post_GetLvXiaoYouCustomerLogin", b2bLoginParam, b2bRes => {
var b2bData = b2bRes.data;
if (b2bRes.resultCode == 1) {
b2bResult.accountId = b2bData.accountId;
b2bResult.accountId = b2bData.customerAccountId;
b2bResult.customerId = b2bData.customerId;
b2bResult.customerInfoChildrenId=b2bData.customerInfoChildrenId;
b2bResult.name = b2bData.name;
......
<template>
<view class="coupondetailsStyle" :style="{ height: contentHeight }">
<view class="coupondetailsStyle" :style="{ height: contentHeight }">
<view class="cd_box">
<Text class='cd_name'>
{{g.Name}}
</Text>
<!-- <Text class='sub_price'>
{{g.sub_price}}
</Text> -->
<view style="display: flex;align-items: flex-end;">
<Text style='font-size: 32px;'>{{ g.DiscountsPrice }} </Text>
<Text style='font-size: 14px;'>{{g.CouponType==2?'折':""}}</Text>
<Text style='font-size: 32px;'>{{ g.DiscountsPrice }} </Text>
<Text style='font-size: 14px;'>{{g.CouponType==2?'折':""}}</Text>
</view>
<Text class='condition'>
{{g.MinConsumePrice }}可用
</Text>
<!-- <Text v-if='g.type==1'>优惠上限:¥{{Number(g.MaxDiscountsPrice) }}</Text> -->
</Text>
<view v-if='type==2 && g.IsReceive==0' class="receive" :style="{'background':mainColor}" @click="receive(g.CouponId)">
<Text>
立即领取
立即领取
</Text>
</view>
<view v-if='type==1 || g.IsReceive==1' class="gouse" @click="gouseUrl(g)">
<view v-if='type==1 || g.IsReceive==1' class="gouse" @click="gouseUrl(g)">
<Text>
去使用
</Text>
</view>
<view style="width: 100%;border-top: 1px dashed #f5f5f5;margin: 10px 0;"></view>
<Text class='c_name' style='margin-top: 25px;'>有效期</Text>
<Text class='cd_content' v-if='g.IndateType==1'>领取后{{g.IndateDay}}天内有效</Text>
<Text class='cd_content' v-if='g.IndateType==2'>{{g.StartDate}}-{{g.EndDate}}</Text>
<!-- <Text class='cd_content' >{{g.StartDate}}-{{g.EndDate}}</Text> -->
<Text class='c_name' style='margin-top: 1px;'>使用规则</Text>
<Text class='cd_content' v-if='g.UseType==1'>适用类别: <Text v-for="(item, index) in g.ProductList" :key="index">{{item.Relevance}}</Text> </Text>
<Text class='cd_content' v-if='g.UseType==2'>适用商品: <Text v-for="(item, index) in g.ProductList" :key="index">{{item.Relevance}}</Text> </Text>
<Text class='cd_content' v-if='g.UseType==1'>适用类别: <Text v-for="(item, index) in g.ProductList" :key="index">{{item.Relevance}}</Text>
</Text>
<Text class='cd_content' v-if='g.UseType==2'>适用商品: <Text v-for="(item, index) in g.ProductList" :key="index">{{item.Relevance}}</Text>
</Text>
<Text class='cd_content' v-if='g.UseType==3'>适用范围:全场通用</Text>
<Text class='cd_content' v-if='g.UseType==4'>适用方式:当面付</Text>
<Text class='c_name' style='margin-top: 1px;'>使用说明</Text>
<Text class='cd_content'>{{g.Describe}}</Text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageTitle: "优惠券详情",
mainColor: "",
contentHeight: 0,
g: [],
loading: false,
coupon_id:0,
isreceive:false,
type:0,//type 1是优惠券列表来的 2 是领券中心来的
};
},
created() {
this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
this.mainColor = this.$uiConfig.mainColor;
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad: function (option) {
this.type = option.type
let item = JSON.parse(decodeURIComponent(option.item))
this.g = item
},
methods: {
receive(id){
this.request2(
{
url: '/api/AppletUser/GrantCoupon',
data: {
CouponId:id
export default {
data() {
return {
pageTitle: "优惠券详情",
mainColor: "",
contentHeight: 0,
g: [],
loading: false,
coupon_id: 0,
isreceive: false,
type: 0, //type 1是优惠券列表来的 2 是领券中心来的
};
},
created() {
this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
this.mainColor = this.$uiConfig.mainColor;
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata") ?
wx.getStorageSync("basedata").bar_title : [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad: function(option) {
this.type = option.type
let item = JSON.parse(decodeURIComponent(option.item))
this.g = item;
console.log("this.g",this.g);
},
methods: {
receive(id) {
this.request2({
url: '/api/AppletUser/GrantCoupon',
data: {
CouponId: id
}
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: res.message,
icon: "none"
});
this.g.IsReceive = 1;
}
}
);
},
gouseUrl(g) {
uni.redirectTo({
url: '/pages/index/index'
});
}
},
(res) => {
if(res.resultCode==1){
uni.showToast({
title: res.message,
icon: "none"
});
this.g.IsReceive=1;
}
}
);
},
gouseUrl(g){
// let data = []
// if(g.UseType==1 || g.UseType==2){
// g.ProductList.forEach(x=>{
// data.push(x.ProductId)
// })
// let id = data.toString()
// uni.redirectTo({ url: '/pages/goods/list?coupon_id='+ id+'&UseType='+g.UseType });
// }else{
// uni.redirectTo({ url: '/pages/goods/list'});
// }
uni.redirectTo({ url: '/pages/index/index'});
}
},
};
};
</script>
<style>
.coupondetailsStyle {
width: 100%;
height: 100%;
background: #f3f4f6;
padding-top:10px ;
}
.coupondetailsStyle .cd_box{
width: 94%;
border-radius: 10rpx;
background: #fff;
margin-left: 3%;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
}
.cd_box .cd_name{
font-size: 14px;
color: #82848a;
margin-top: 30px;
}
.cd_box .sub_price{
font-size: 32px;
margin-top: 10px;
}
.cd_box .condition{
font-size: 16px;
margin-top: 5px;
}
.cd_box .receive{
width: 130px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
color: #fff;
margin-top: 15px;
border-radius: 15px;
}
.cd_box .gouse{
width: 130px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
color: #fff;
margin-top: 15px;
border-radius: 15px;
background: #6995EE;
}
.cd_box .c_name{
width: 90%;
font-size: 14px;
color: #82848a;
}
.cd_box .cd_content{
padding: 15px 0;
width: 90%;
font-size: 15px;
}
.coupondetailsStyle {
width: 100%;
height: 100%;
background: #f3f4f6;
padding-top: 10px;
}
.coupondetailsStyle .cd_box {
width: 94%;
border-radius: 10rpx;
background: #fff;
margin-left: 3%;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
}
.cd_box .cd_name {
font-size: 14px;
color: #82848a;
margin-top: 30px;
}
.cd_box .sub_price {
font-size: 32px;
margin-top: 10px;
}
.cd_box .condition {
font-size: 16px;
margin-top: 5px;
}
.cd_box .receive {
width: 130px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
color: #fff;
margin-top: 15px;
border-radius: 15px;
}
.cd_box .gouse {
width: 130px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
color: #fff;
margin-top: 15px;
border-radius: 15px;
background: #6995EE;
}
.cd_box .c_name {
width: 90%;
font-size: 14px;
color: #82848a;
}
.cd_box .cd_content {
padding: 15px 0;
width: 90%;
font-size: 15px;
}
</style>
......@@ -2,22 +2,15 @@
<view class="couponStyle" :style="{ height: contentHeight }">
<u-tabs :list="list" :is-scroll="false" :current="currentIndex" @change="change" :active-color="mainColor" :show-bar="showBar"
height="100"></u-tabs>
<u-empty v-if="g.length == 0 && !loading" text="暂无相关优惠券" mode="coupon"></u-empty>
<u-empty v-if="couponDataList.length == 0 && !loading" text="暂无相关优惠券" mode="coupon"></u-empty>
<view v-if="g.length > 0" style="
height: calc(100vh - 50px);
width: calc(100vw);
overflow: hidden;
padding-bottom: 50px;
">
<view v-if="couponDataList.length > 0" style=" height: calc(100vh - 50px); width: calc(100vw); overflow: hidden;padding-bottom: 50px;">
<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" @scrolltolower="lower" :style="{ height: '100%' }">
<view class="couponList">
<view class="item" v-for="(x, i) in g" :key="i" @click="godetails(x)">
<view :class="{'ticket':msg.useState == 1,'ticket2':msg.useState != 1}">
<view class="item" v-for="(x, i) in couponDataList" :key="i" @click="godetails(x)">
<view :class="{'ticket':msg.CouponStatus == 1,'ticket2':msg.CouponStatus != 1}">
<view class="miane">
<view class="money">
<!-- <text style="font-size: 44px;">{{x.sub_price.toString().split('.')[0]}}</text>
<text v-if="x.coupon.type==1"></text> -->
<text class="small" style="font-family: microsoft yahei ui light;" v-if="x.couponsType == 1"></text>
<Text style="font-size: 44px;font-family: nav-font;">{{ Number(x.denomination) }}
</Text>
......@@ -25,34 +18,13 @@
</view>
<view class="tiaojian">{{ Number(x.useCondition) }}元可用</view>
</view>
<view style="
width: 10px;
height: 10px;
border-radius: 5px;
background: #f3f4f6;
position: absolute;
right: -5px;
top: -5px;
"></view>
<view style="
width: 10px;
height: 10px;
border-radius: 5px;
background: #f3f4f6;
position: absolute;
right: -5px;
bottom: -5px;
"></view>
<view style="width: 10px;height: 10px; border-radius: 5px;background: #f3f4f6; position: absolute; right: -5px; top: -5px;"></view>
<view style=" width: 10px; height: 10px; border-radius: 5px; background: #f3f4f6; position: absolute; right: -5px; bottom: -5px; "></view>
</view>
<view class="detail">
<view class="coupond">
<view class="name" style="font-family:'microsoft yahei ui light';">{{ x.couponsName }}</view>
<view class="name" style="font-family:'microsoft yahei ui light';">{{ x.couponName }}</view>
<view class="date">{{ x.expirationDate }} 失效</view>
<Text class="rule" v-if="x.lineTeamName!='' || x.lineName!=''">{{x.lineName}} {{x.lineTeamName}} 可用</Text>
<!-- <Text class="rule" v-if="x.UseTypeStr == 2">限商品</Text>
<Text class="rule" v-if="x.UseTypeStr == 3">全场通用</Text>
<Text class="rule" v-if="x.UseTypeStr == 4">当面付</Text> -->
</view>
</view>
</view>
......@@ -61,22 +33,7 @@
<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="20" :margin-bottom="20" bg-color="#f3f4f6" />
</scroll-view>
</view>
<!-- <view
style="
width: 100%;
height: 50px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
left: 0;
bottom: 0;
"
@click="goUrl"
>
<Text>去领券</Text>
</view> -->
<!-- 加载中 -->
<view class="loading" v-if="loading">
<u-loading mode="flower" size="48">></u-loading>
......@@ -87,7 +44,6 @@
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view>
</template>
<script>
import auth from "../../../components/auth/index.vue";
export default {
......@@ -100,27 +56,26 @@
showAuth: false,
U: {},
list: [{
name: "未使用"
}, {
name: "已过期"
}],
name: "未使用"
},
{
name: "已使用"
},
{
name: "已过期"
}
],
mainColor: "",
contentHeight: 0,
currentIndex: 0,
msg: {
"pageIndex": 1,
"pageSize": 8,
"useState": 1,
"lineId": 0,
"lineteamId": 0,
"couponsName": "",
"couponsType": 0,
"couponStatus": 1,
"couponEffectStatus": 1, //1 有效;3 无效
"couponsUseScope": 0,
"userId": 15625, //CustomerAccountId
"CouponStatus": 1, // 优惠券状态 1未使用 2已使用 3已过期
},
page_count: 1,
g: [],
couponDataList: [],
loading: false,
status: "loadmore",
loadText: {
......@@ -142,8 +97,7 @@
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata") ?
wx.getStorageSync("basedata").bar_title :
[];
wx.getStorageSync("basedata").bar_title : [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
......@@ -154,68 +108,35 @@
});
},
onLoad: function(option) {
// this.u = uni.getStorageSync("mall_UserInfo");
// if (!this.u) {
// this.u = {
// nickName: "未登录",
// avatarUrl: "",
// };
// this.showAuth = true;
// } else {
// this.init();
// }
this.loading = true
this.init()
},
methods: {
change(index) {
this.currentIndex = index
this.msg.useState = index == 0 ? 1 : 3;
this.currentIndex = index;
this.msg.CouponStatus = index + 1;
this.msg.pageIndex = 1;
this.g = [];
this.couponDataList = [];
this.loading = true;
this.init();
},
init() {
uni.showLoading()
// this.apipost("b2b_post_LvXiaoYouBindCustomerInfo", param, (res) => {
// if (res.resultCode == 1) {
// //移除缓存=>跳转到首页重新登录
// uni.removeStorageSync('b2b_user')
// uni.removeStorageSync('mall_UserInfo')
// uni.redirectTo({
// url: '/pages/index/index'
// })
// } else {
// this.loginLoading = false
// uni.hideLoading()
// }
// }, (failed) => {
// this.loginLoading = false;
// uni.showToast({
// title: failed.message,
// icon: "none",
// });
// }, (error) => {
// this.loginLoading = false;
// uni.hideLoading()
// })
this.javaApipost('b2b/user/getUserCouponAllotList', this.msg, (res) => {
this.loading = true;
this.apipost("coupon_post_GetUserCanUseCouponPageList", this.msg, (res) => {
this.loading = false;
this.g = this.g.concat(res.data.pageData);
this.page_count = res.data.pageCount;
if (this.page_count == 1) {
this.status = "nomore";
if (res.resultCode == 1) {
this.couponDataList = res.data.pageData;
this.page_count = res.data.pageCount;
console.log("this.couponDataList", this.couponDataList)
}
uni.hideLoading()
}, (err) => {
console.log(err)
uni.hideLoading()
}, (failed) => {
uni.showToast({
title: failed.message,
icon: "none",
});
this.loading = false;
}, (error) => {
this.loading = false;
})
},
lower(e) {
......@@ -229,7 +150,6 @@
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
// this.showAuth=false;
this.init();
},
//关闭登录窗口
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment