Commit dc7d1f6d by 前端

Merge branch 'SAAS+V4.50' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V4.50

2 parents 06649e2c 6eb6bb78
......@@ -172,5 +172,13 @@ module.exports = {
projectName: 'boutique',
...data
})
},
/** 查询附近地址 */
searchStoreAddress(data) {
return http.post({
method: 'dj.api.car.boutique.resident.coupon.address.search',
projectName: 'boutique',
...data
})
}
}
......@@ -51,7 +51,7 @@
<view :class="['coupon-bg', `${TYPE_LIST[item.couponState]}-bg`]">
<image v-if="item.couponState == 2" class="claimed-left" :src="require('@/assets/images/point/claimed-left.png')" alt="" />
<view class="coupon-img">
<image class="img" :src="item.couUrl || require('@/assets/images/point/default-coupon.png')" alt="" />
<image class="img" mode="aspectFill" :src="item.couUrl || require('@/assets/images/point/default-coupon.png')" alt="" />
</view>
<view class="coupon-info">
<view :class="['coupon-name', { 'gray-name': item.couponState == 3 }]">{{ item.couponName}}
......@@ -147,10 +147,10 @@
</template> -->
</view>
</view>
<view class="store-info">
<view class="store-info" v-if="this.storeAddress">
<view class="sprite-icon icon-icon-store"></view>
<p class="store-label">附近门店</p>
<p class="store-address">{{ couponDetailInfo.merchantAddress }}</p>
<p class="store-address">{{ storeAddress }}</p>
<view class="copy-btn" @click="copyText"><view class="sprite-icon icon-icon-copy copy"></view>复制</view>
</view>
<view :class="['usage-notice', couponDetailInfo.couponState == 2 ? 'claimed-usage':'']">
......@@ -233,7 +233,8 @@ export default {
},
total: 0,
pageNum: 1,
pageSize: 8
pageSize: 12,
storeAddress: ''
}
},
props: {
......@@ -252,6 +253,31 @@ export default {
console.log('init');
this.getGrantRecord()
},
getLocation(brandName) {
uni.getLocation({
type: 'gcj02',
geocode: true, // 设置为 true 可直接获取经纬度及城市信息
success: function (res) {
console.log(res, '===='); // 打印位置信息
// 处理位置数据
const params = {
brandName,
lat: res.latitude,
lng: res.longitude
}
uni.$api.pointApi.searchStoreAddress(params).then(res => {
console.log(res, '======');
this.storeAddress = res
})
},
fail: function () {
uni.showToast({
title: '获取地址失败,将导致部分功能不可用',
icon: 'none'
});
}
});
},
/** 接口调用 uni.$api.pointApi*/
// 优惠券个数
statisticsCount() {
......@@ -265,27 +291,37 @@ export default {
this.typeList[3].num = () => `(${res[2]})`
})
},
getGrantRecord(couponState) {
console.log('查询优惠券列表');
const { pageNum, pageSize } = this
const params = {
staffPhone: uni.$storage.get('userInfo').phone,
pageNum,
pageSize
}
if (couponState) params.couponState = couponState
console.log(params, 'chaxun');
uni.$api.pointApi.getGrantRecord(params).then(res => {
async getGrantRecord(couponState) {
try {
uni.showLoading({
mask: true
})
console.log('查询优惠券列表');
const { pageNum, pageSize } = this
const params = {
staffPhone: uni.$storage.get('userInfo').phone,
pageNum,
pageSize
}
if (couponState) params.couponState = couponState
console.log(params, 'chaxun');
const res = await uni.$api.pointApi.getGrantRecord(params)
console.log(res, '========================', pageNum);
if(pageNum == 1) {
this.list = res.list
} else {
this.list = this.list.concat(res.list)
}
uni.hideLoading()
this.total = res.total
this.nothing = res.length ? true : false
})
this.statisticsCount()
this.statisticsCount()
}
catch (error) {
uni.showToast({
title: 'error',
});
}
},
changeType(index, name) {
console.log(index, name);
......@@ -324,10 +360,12 @@ export default {
// 使用优惠券
this.showCouponPon = true
// this.couponDetailInfo = row
this.getLocation(row.brandName)
break
case 2:
this.showCouponPon = true
// this.couponDetailInfo = row
this.getLocation(row.brandName)
break
default:
return
......@@ -335,6 +373,7 @@ export default {
},
closePop() {
this.showCouponPon = false
this.storeAddress = ''
},
// 领取使用按钮
handleUse() {
......@@ -363,7 +402,7 @@ export default {
// 复制
copyText() {
uni.setClipboardData({
data: this.couponDetailInfo.merchantAddress,
data: this.storeAddress,
success: function() {
uni.showToast({
title: '复制成功',
......@@ -567,13 +606,13 @@ export default {
align-items: center;
justify-content: center;
background-color: #fff;
width: toRpx(152);
width: toRpx(240);
height: toRpx(152);
margin: toRpx(40) auto;
border-radius: toRpx(32);
.img {
width: toRpx(152);
width: toRpx(240);
height: toRpx(152);
border-radius: toRpx(32);
}
......@@ -1049,9 +1088,9 @@ export default {
.coupon-tips {
display: flex;
align-items: center;
justify-content: center;
color: #EF6F2C;
font-size: toRpx(28);
padding-left: toRpx(36);
}
.coupon-qrcode {
width: 100%;
......@@ -1092,7 +1131,7 @@ export default {
}
}
.redeem-code {
padding: 0 toRpx(132);
padding: 0 toRpx(40);
margin: toRpx(48) 0 toRpx(80);
.redeem-item {
display: flex;
......@@ -1176,7 +1215,7 @@ export default {
color: #020305;
font-weight: 500;
margin-bottom: toRpx(16);
padding: 0 toRpx(32);
padding: 0 toRpx(26);
}
.usage-notice {
background-color: #F5F7FA;
......
......@@ -52,7 +52,9 @@
<template v-if="couponCount">
<view class="coupon-card">
<view v-for="item in couponList" :key="item.id" class="card-bg" :class="item.isclaimed ? 'claimed-bg' : 'unclaimed-bg'">
<view class="coupon-img"></view>
<view class="coupon-img">
<image mode="aspectFit" :src="item.couUrl || require('@/assets/images/point/default-coupon.png')" alt="" />
</view>
<view class="coupon-right">
<view :class="['coupon-name', item.couponState == 2 ? 'unclaimed-name':'']">{{ item.couponName }}</view>
<view :class="['coupon-price', item.couponState == 2 ? 'unclaimed-price':'']">价值¥{{ item.lineationPrice }}</view>
......@@ -370,6 +372,11 @@ export default {
width: toRpx(88);
height: toRpx(112);
border-radius: toRpx(16);
image {
width: toRpx(88);
height: toRpx(112);
border-radius: toRpx(16);
}
}
.coupon-right {
margin-left: toRpx(24);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!