|
|
@ -14,13 +14,38 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line1 mart15"></view> |
|
|
|
<view class="line1 mart15"></view> |
|
|
|
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN" @click="jumpres">点击领取</button> |
|
|
|
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN" |
|
|
|
<button class="coupne-btn width60w mart20 marb20" v-else @click="receiveDiscount">点击领取</button> |
|
|
|
@click="jumpres">点击领取</button> |
|
|
|
<view class="width90 mart10 fcor666">去使用</view> |
|
|
|
<button class="coupne-btn width60w mart20 marb20" |
|
|
|
<view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666"> |
|
|
|
v-if="userInfo != 1 && couponsDetails.highDiscountAgentCode.status == 1" |
|
|
|
|
|
|
|
@click="receiveDiscount">点击领取</button> |
|
|
|
|
|
|
|
<!-- <button class="coupne-btn width60w mart20 marb20" |
|
|
|
|
|
|
|
v-if="userInfo != 1 && couponsDetails.highDiscountAgentCode.status != 1 && couponsDetails.highDiscount.usingRange == 5" |
|
|
|
|
|
|
|
@click="useDiscount">立即使用</button> --> |
|
|
|
|
|
|
|
<view class="alijus width90 mart20" |
|
|
|
|
|
|
|
v-if="userInfo != 1 && couponsDetails.highDiscountAgentCode.status != 1 && couponsDetails.highDiscount.usingRange == 5"> |
|
|
|
|
|
|
|
<view class="width40" style="margin-right: 5%;" @click="useDiscount"> |
|
|
|
|
|
|
|
<view class="width100 btnno fotct font16 backcor008">立即使用</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="width40" style="margin-left: 5%;" @click="jumpCounlist"> |
|
|
|
|
|
|
|
<view class="width100 btnno fotct font16 backcor008">立即查看</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="width90 mart30" v-if="couponsDetails.highDiscount.usingRange == 5"> |
|
|
|
|
|
|
|
<image :src="imagewxUrl+imgadres3" mode="widthFix" class="width100" |
|
|
|
|
|
|
|
v-if="couponsDetails.highDiscountAgentCode.status ==1"></image> |
|
|
|
|
|
|
|
<image :src="imagewxUrl+imgadres1" mode="widthFix" class="width100" |
|
|
|
|
|
|
|
v-if="couponsDetails.highDiscountAgentCode.status != 1"></image> |
|
|
|
|
|
|
|
<image :src="imagewxUrl+imgadres2" mode="widthFix" class="width100" |
|
|
|
|
|
|
|
v-if="couponsDetails.highDiscountAgentCode.status != 1"></image> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="width90 mart10 fcor666" v-if="couponsDetails.highDiscount.usingRange != 5">去使用</view> |
|
|
|
|
|
|
|
<view v-if="minecoupones == '' && couponsDetails.highDiscount.usingRange != 5" |
|
|
|
|
|
|
|
class="mart60 fotct font14 fcor666"> |
|
|
|
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> |
|
|
|
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="product-list mart20 width90"> |
|
|
|
<view class="product-list mart20 width90" v-if="couponsDetails.highDiscount.usingRange != 5"> |
|
|
|
<view class="product" v-for="product in minecoupones" :key="product.id" |
|
|
|
<view class="product" v-for="product in minecoupones" :key="product.id" |
|
|
|
@tap="toGoods(product.highCoupon.id)"> |
|
|
|
@tap="toGoods(product.highCoupon.id)"> |
|
|
|
<image mode="widthFix" :src="imageUrl+product.highCoupon.couponImg"></image> |
|
|
|
<image mode="widthFix" :src="imageUrl+product.highCoupon.couponImg"></image> |
|
|
@ -35,13 +60,11 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="info" v-else> |
|
|
|
<view class="info" v-else> |
|
|
|
<view class="price"> |
|
|
|
<view class="price"> |
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;" |
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;" src="../../../static/img/jfx.png"> |
|
|
|
src="../../../static/img/jfx.png"> |
|
|
|
|
|
|
|
</image>{{ product.highCoupon.discountPrice*100}} |
|
|
|
</image>{{ product.highCoupon.discountPrice*100}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="slogan" v-if="product.highCoupon.discountPrice !== product.highCoupon.salesPrice"> |
|
|
|
<view class="slogan" v-if="product.highCoupon.discountPrice !== product.highCoupon.salesPrice"> |
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;" |
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;" src="../../../static/img/jfh.png"> |
|
|
|
src="../../../static/img/jfh.png"> |
|
|
|
|
|
|
|
</image>{{ product.highCoupon.salesPrice*100}} |
|
|
|
</image>{{ product.highCoupon.salesPrice*100}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -62,7 +85,8 @@ |
|
|
|
receiveDiscount, |
|
|
|
receiveDiscount, |
|
|
|
HandleCode, |
|
|
|
HandleCode, |
|
|
|
getUserInfo, |
|
|
|
getUserInfo, |
|
|
|
loginByPhone |
|
|
|
loginByPhone, |
|
|
|
|
|
|
|
useDiscount |
|
|
|
} from '../../../Utils/Api.js'; |
|
|
|
} from '../../../Utils/Api.js'; |
|
|
|
// import authorize from '../../../components/Authorize'; |
|
|
|
// import authorize from '../../../components/Authorize'; |
|
|
|
let app = getApp(); |
|
|
|
let app = getApp(); |
|
|
@ -75,7 +99,10 @@ |
|
|
|
minecoupones: [], |
|
|
|
minecoupones: [], |
|
|
|
imageUrl: app.globalData.imgUrl, |
|
|
|
imageUrl: app.globalData.imgUrl, |
|
|
|
imagewxUrl: app.globalData.imageWxImg, |
|
|
|
imagewxUrl: app.globalData.imageWxImg, |
|
|
|
imgadres:'noorder.png', |
|
|
|
imgadres: 'noorder.png', |
|
|
|
|
|
|
|
imgadres1: 'noCoupon.jpg', |
|
|
|
|
|
|
|
imgadres2: 'onCoupon.jpg', |
|
|
|
|
|
|
|
imgadres3: 'showCoupon.jpg', |
|
|
|
pageNum: 1, |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
|
isNoMoreData: false, |
|
|
|
isNoMoreData: false, |
|
|
@ -169,10 +196,11 @@ |
|
|
|
if (res.return_code == '000000') { |
|
|
|
if (res.return_code == '000000') { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
title: res.return_data, |
|
|
|
title: '操作成功', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
this.getDiscountByQrCode(); |
|
|
|
|
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
title: res.return_msg, |
|
|
|
title: res.return_msg, |
|
|
@ -186,71 +214,71 @@ |
|
|
|
getuserinfo() { |
|
|
|
getuserinfo() { |
|
|
|
let that = this; |
|
|
|
let that = this; |
|
|
|
// wx.login({ |
|
|
|
// wx.login({ |
|
|
|
// success(res) { |
|
|
|
// success(res) { |
|
|
|
// if (res.code) { |
|
|
|
// if (res.code) { |
|
|
|
// 发起网络请求 |
|
|
|
// 发起网络请求 |
|
|
|
// var code = res.code; |
|
|
|
// var code = res.code; |
|
|
|
// 获取微信用户信息 |
|
|
|
// 获取微信用户信息 |
|
|
|
uni.getUserProfile({ |
|
|
|
uni.getUserProfile({ |
|
|
|
desc: '登录中...', |
|
|
|
desc: '登录中...', |
|
|
|
success: function(res) { |
|
|
|
success: function(res) { |
|
|
|
let params = { |
|
|
|
let params = { |
|
|
|
openId: app.globalData.openId, |
|
|
|
openId: app.globalData.openId, |
|
|
|
iv: res.iv, |
|
|
|
iv: res.iv, |
|
|
|
encryptedData: res.encryptedData |
|
|
|
encryptedData: res.encryptedData |
|
|
|
} |
|
|
|
} |
|
|
|
getUserInfo(params).then(res => { |
|
|
|
getUserInfo(params).then(res => { |
|
|
|
if (res.return_code == '000000') { |
|
|
|
if (res.return_code == '000000') { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.hideLoading(); |
|
|
|
app.globalData.userInfo = res |
|
|
|
app.globalData.userInfo = res |
|
|
|
.return_data |
|
|
|
.return_data |
|
|
|
.object |
|
|
|
.object |
|
|
|
.highUser; |
|
|
|
.highUser; |
|
|
|
app.globalData.token = res |
|
|
|
app.globalData.token = res |
|
|
|
.return_data.uniqueCode; |
|
|
|
.return_data.uniqueCode; |
|
|
|
uni.setStorage({ |
|
|
|
uni.setStorage({ |
|
|
|
key: "user", |
|
|
|
key: "user", |
|
|
|
data: res.return_data |
|
|
|
data: res.return_data |
|
|
|
.object |
|
|
|
.object |
|
|
|
.highUser |
|
|
|
.highUser |
|
|
|
}) |
|
|
|
}) |
|
|
|
uni.setStorage({ |
|
|
|
uni.setStorage({ |
|
|
|
key: "token", |
|
|
|
key: "token", |
|
|
|
data: res.return_data |
|
|
|
data: res.return_data |
|
|
|
.uniqueCode |
|
|
|
.uniqueCode |
|
|
|
}) |
|
|
|
}) |
|
|
|
that.receiveDiscount(); |
|
|
|
that.receiveDiscount(); |
|
|
|
that.userInfo = 2; |
|
|
|
that.userInfo = 2; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.hideLoading(); |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.return_msg, |
|
|
|
title: res.return_msg, |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
fail: res => { |
|
|
|
fail: res => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: "微信登录授权失败", |
|
|
|
title: "微信登录授权失败", |
|
|
|
icon: "none" |
|
|
|
icon: "none" |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
// } else { |
|
|
|
// } else { |
|
|
|
// uni.showToast({ |
|
|
|
// uni.showToast({ |
|
|
|
// title: "微信登录授权失败", |
|
|
|
// title: "微信登录授权失败", |
|
|
|
// icon: "none" |
|
|
|
// icon: "none" |
|
|
|
// }); |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 微信获取手机号 |
|
|
|
// 微信获取手机号 |
|
|
|
loginByPhone(PhoneNumber) { |
|
|
|
loginByPhone(PhoneNumber) { |
|
|
|
if(PhoneNumber.detail.iv == undefined){ |
|
|
|
if (PhoneNumber.detail.iv == undefined) { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: "用户取消授权", |
|
|
|
title: "用户取消授权", |
|
|
|
icon: "none" |
|
|
|
icon: "none" |
|
|
@ -289,17 +317,38 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
//使用优惠券 |
|
|
|
|
|
|
|
useDiscount() { |
|
|
|
|
|
|
|
let datas = { |
|
|
|
|
|
|
|
discountAgentCodeId: this.couponsDetails.highDiscountAgentCode.id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
useDiscount(datas).then(res => { |
|
|
|
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
uni.showModal({ |
|
|
|
|
|
|
|
title: '温馨提示', |
|
|
|
|
|
|
|
content: '请前往微信“中油好客e站”小程序使用,须在有效期30天内使用。(中油好客E站APP也可使用)', |
|
|
|
|
|
|
|
success: function(res) {} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: res.return_msg, |
|
|
|
|
|
|
|
duration: 2000, |
|
|
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
//跳转登录 |
|
|
|
//跳转登录 |
|
|
|
jumpres() { |
|
|
|
jumpres() { |
|
|
|
uni.navigateTo({ |
|
|
|
uni.navigateTo({ |
|
|
|
url:'../../login/register?id=2' |
|
|
|
url: '../../login/register?id=2' |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//商品跳转 |
|
|
|
//商品跳转 |
|
|
|
toGoods(e) { |
|
|
|
toGoods(e) { |
|
|
|
if (app.globalData.userInfo) { |
|
|
|
if (app.globalData.userInfo) { |
|
|
|
uni.navigateTo({ |
|
|
|
uni.navigateTo({ |
|
|
|
url: '../../order/confirmation?id=' + e +'&typeid=2' |
|
|
|
url: '../../order/confirmation?id=' + e + '&typeid=2' |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
@ -308,6 +357,12 @@ |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//跳转列表 |
|
|
|
|
|
|
|
jumpCounlist() { |
|
|
|
|
|
|
|
uni.reLaunch({ |
|
|
|
|
|
|
|
url: '/pages/user/coupon/coupon' |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -323,7 +378,13 @@ |
|
|
|
width: 80px; |
|
|
|
width: 80px; |
|
|
|
height: 80px; |
|
|
|
height: 80px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.btnno { |
|
|
|
|
|
|
|
height: 40px; |
|
|
|
|
|
|
|
line-height: 40PX; |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
color: #ffffff; |
|
|
|
|
|
|
|
} |
|
|
|
.product-list { |
|
|
|
.product-list { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
justify-content: space-between; |
|
|
|