积分抵扣、霸王餐、优惠券分享新增

This commit is contained in:
GaoHao
2024-11-07 15:02:44 +08:00
parent bec723cd69
commit 7b81e2ffb0
29 changed files with 2375 additions and 887 deletions

View File

@@ -0,0 +1,129 @@
<template>
<view class="container">
<view class="list">
<view class="listItem " v-for="(item,index) in list" :key="index">
<view class="top">
<view class="title">{{item.content}}</view>
<view class="num">{{item.floatPoints}}</view>
</view>
<view class="time">{{item.createTime}}</view>
</view>
</view>
<image
v-if="list.length <= 0 "
style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png"
mode="aspectFill"
/>
<u-loadmore :status="status" fontSize="28" color="#999" iconSize="28" style="margin-top: 32rpx;"/>
</view>
</template>
<script>
export default {
data() {
return {
query: {
page: 1,
size: 10,
},
list: [],
shopId: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
status: "nomore" // loadmore nomore loading
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
},
onShow() {
this.getMemberPointsLogList()
},
onReachBottom() {
this.getMemberPointsLogList()
},
methods: {
/**
* 获取积分明细列表
*/
async getMemberPointsLogList() {
let res = await this.api.memberPointsLogList({
shopId: this.shopId,
memberId: this.shopUserInfo.id,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
}
}
};
</script>
<style scoped lang="scss">
.container{
padding: 16rpx 0;
}
.list{
background: #FFFFFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.listItem{
display: flex;
flex-direction: column;
padding: 32rpx 20rpx;
border-bottom: 1rpx solid #E5E5E5;
.top{
display: flex;
justify-content: space-between;
align-items: center;
font-weight: bold;
color: #333333;
.title{
font-size: 28rpx;
}
.num{
font-size: 32rpx;
}
}
.time{
font-weight: normal;
font-size: 28rpx;
color: #999999;
margin-top: 16rpx;
}
}
.listItem:last-child{
border-bottom: none;
}
}
</style>

View File

@@ -0,0 +1,349 @@
<template>
<view class="container">
<view class="head_bg"></view>
<view class="shopInfo" v-if="goodsData.goodsCategory == 'physical'">
<view class="type">自取门店</view>
<view class="info">
<view class="shopName">{{shopUserInfo.shopName}}</view>
<view class="shopTel">{{shopUserInfo.telephone}}</view>
</view>
<view class="address">
<view style="width: 70%;">{{shopUserInfo.address}}</view>
<u-icon name="arrow-right" color="#595959" size="28"></u-icon>
</view>
</view>
<view class="orderInfo">
<view class="goods">
<image class="icon" :src="goodsData.goodsImageUrl" mode="aspectFill" />
<view class="info">
<view class="title">{{goodsData.goodsName}}</view>
<view class="numAll">
<view class="points">{{goodsData.requiredPoints}}积分</view>
<view class="num">X1</view>
</view>
</view>
</view>
<view class="cell">
<view class="label">使用积分</view>
<view class="value">{{goodsData.requiredPoints}}积分</view>
</view>
<view class="cell">
<view class="label"></view>
<view class="value">合计{{goodsData.extraPrice}}</view>
</view>
</view>
<view class="bom">
<view class="exchangeBtn" @click="pointsCreateOrder">确认兑换</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
query: {
page: 1,
size: 10,
},
shopId: null,
goodsData: null,
orderInfo: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
if ( options.goodsData ) {
this.goodsData = JSON.parse(options.goodsData);
}
},
onShow() {
this.getExchangeRecordList();
},
onReachBottom() {
this.getExchangeRecordList()
},
methods: {
/**
* 获取兑换记录
*/
async getExchangeRecordList() {
let res = await this.api.exchangeRecordList({
shopId: this.shopId,
memberId: this.shopUserInfo.id,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
},
/**
* 确认兑换
*/
confirmExchange () {
if ( this.goodsData.extraPrice > 0 ) {
} else {
this.pointsCreateOrder()
}
},
/**
* 微信/支付宝支付
*/
async pointsPayOrder(orderInfo) {
let payType;
if ( this.goodsData.extraPrice > 0 ) {
// #ifdef MP-WEIXIN
payType = 'WECHAT';
// #endif
// #ifdef MP-ALIPAY
payType = 'ALIPAY';
// #endif
} else {
payType = 'POINTS'
}
let res = await this.api.pointsPayOrder({
id: orderInfo.id,
payType: payType,
openId: uni.cache.get('miniAppOpenId'),
}) //判断是否支付成功
if (res.code == 0) {
this.orderInfo = res.data;
let payInfo = JSON.parse(res.data.payInfo);
if ( payType == 'POINTS') {
uni.navigateTo({
url: `/pagesPoints/exchangeRecordDetail/index?shopId=${this.shopId}&orderInfo=${JSON.stringify(this.orderInfo)}`,
})
return;
}
// 微信支付还是余额支付
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: payInfo.appId, // 微信支付商户号
timeStamp: payInfo.timeStamp, // 时间戳(单位:秒)
nonceStr: payInfo.nonceStr, // 随机字符串
package: payInfo.package, // 固定值
signType: payInfo.signType, //固定值
paySign: payInfo.paySign, //签名
// #endif
// #ifdef MP-ALIPAY
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
// #endif
success: (res) => {
let _this = this
uni.showToast({
title: "支付成功"
})
uni.navigateTo({
url: `/pagesPoints/exchangeRecordDetail/index?shopId=${this.shopId}&orderInfo=${JSON.stringify(this.orderInfo)}`,
})
},
fail: async (err) => {
console.log(err)
let res = await this.api.pointsCancelOrder({
id: orderInfo.id,
}) //判断是否支付成功
uni.hideLoading()
}
});
}
},
/**
* 支付完成后请求
*/
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfoid,
})
},
/**
* 生成兑换兑换
*/
async pointsCreateOrder () {
if (this.orderInfo) {
this.pointsPayOrder(this.orderInfo);
return;
}
let res = await this.api.pointsCreateOrder({
shopId: this.shopId,
pointsGoodsId: this.goodsData.id,
pickupMethod: "self",
memberId: this.shopUserInfo.id,
avatarUrl: this.shopUserInfo.headImg,
memberName: this.shopUserInfo.name,
mobile: this.shopUserInfo.telephone,
})
if (res.code == 0) {
this.orderInfo = res.data;
this.pointsPayOrder(res.data);
}
},
}
};
</script>
<style scoped lang="scss">
.container{
padding: 32rpx 20rpx;
.head_bg{
height: 256rpx;
background: linear-gradient(180deg, #E9B183 0%, #F5F5F500 100%);
position: absolute;
left: 0;
right: 0;
top: 0;
margin: auto;
}
.orderInfo,.shopInfo{
display: flex;
flex-direction: column;
background-color: #fff;
border-radius: 18rpx;
position: relative;
z-index: 2;
}
.shopInfo{
padding: 32rpx 24rpx 32rpx 24rpx;
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin-bottom: 32rpx;
.type{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.info{
display: flex;
align-items: center;
margin-top: 24rpx;
margin-bottom: 16rpx;
.shopName{
margin-right: 10rpx;
}
}
.address{
display: flex;
align-items: flex-start;
justify-content: space-between;
}
}
.orderInfo{
padding: 32rpx 24rpx 8rpx 24rpx;
.goods{
display: flex;
margin-bottom: 16rpx;
.icon{
width: 128rpx;
height: 128rpx;
border-radius: 10rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.info{
width: 100%;
display: flex;
flex-direction: column;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 5rpx;
}
.numAll{
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 500;
font-size: 24rpx;
margin-top: 32rpx;
.points{
color: #666;
}
.num{
color: #999;
}
}
}
}
.cell{
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1rpx solid #E5E5E5;
padding: 24rpx 0;
.label{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.value{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
}
.bom{
width: 100%;
position: fixed;
bottom: 0;
left: 0;
z-index: 9;
padding: 16rpx 28rpx 68rpx 28rpx;
display: flex;
justify-content: flex-end;
background-color: #fff;
.exchangeBtn{
width: 214rpx;
height: 64rpx;
line-height: 64rpx;
text-align: center;
background: #E8AD7B;
border-radius: 34rpx 34rpx 34rpx 34rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -0,0 +1,199 @@
<template>
<view class="container">
<view class="list">
<view class="listItem " v-for="(item,index) in list" :key="index">
<view class="head">
<view class="time">兑换时间{{item.createTime}}</view>
<!-- unpaid-待支付 waiting-待自取 done-已完成 cancel-已取消 -->
<view class="status">{{
item.status == 'unpaid' ? '待支付' :
item.status == 'waiting' ? '待自取' :
item.status == 'done' ? '已完成' :
item.status == 'cancel' ? '已取消' : ""
}}</view>
</view>
<view class="content">
<image class="thumbnail" :src="item.goodsImageUrl" mode="aspectFill" />
<view class="info">
<view class="title">{{item.pointsGoodsName}}</view>
<view class="numAll">
<view class="points">{{item.spendPoints}}积分</view>
<view class="num">X1</view>
</view>
</view>
</view>
<view class="bom">
<view class="detail" @click="goDetail(item)">查看详情</view>
</view>
</view>
</view>
<image
v-if="list.length <= 0 "
style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png"
mode="aspectFill"
/>
<u-loadmore :status="status" fontSize="28" color="#999" iconSize="28" />
</view>
</template>
<script>
export default {
data() {
return {
query: {
page: 1,
size: 10,
},
list: [],
shopId: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
status: "nomore" // loadmore nomore loading
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
},
onShow() {
this.getExchangeRecordList();
},
onReachBottom() {
this.getExchangeRecordList()
},
methods: {
/**
* 获取兑换记录
*/
async getExchangeRecordList() {
let res = await this.api.exchangeRecordList({
shopId: this.shopId,
memberId: this.shopUserInfo.id,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
},
/**
* 查看详情
*/
goDetail(item) {
uni.navigateTo({
url: `/pagesPoints/exchangeRecordDetail/index?shopId=${this.shopId}&orderInfo=${JSON.stringify(item)}`,
})
}
}
};
</script>
<style scoped lang="scss">
.container{
}
.list{
// background: #FFFFFF;
// border-radius: 0rpx 0rpx 0rpx 0rpx;
padding: 32rpx 20rpx;
.listItem{
display: flex;
flex-direction: column;
padding: 32rpx 24rpx;
border-bottom: 1rpx solid #E5E5E5;
margin-bottom: 32rpx;
.head{
display: flex;
align-items: center;
justify-content: space-between;
.time{
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
.status{
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.content{
display: flex;
margin-top: 32rpx;
.thumbnail{
width: 128rpx;
height: 128rpx;
border-radius: 10rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.info{
width: 100%;
display: flex;
flex-direction: column;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 5rpx;
}
.numAll{
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 500;
font-size: 24rpx;
margin-top: 32rpx;
.points{
color: #666;
}
.num{
color: #999;
}
}
}
}
.bom{
display: flex;
justify-content: flex-end;
margin-top: 32rpx;
.detail{
padding: 8rpx 16rpx;
background-color: #343030;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-weight: 400;
font-size: 24rpx;
color: #FFFFFF;
}
}
}
}
</style>

View File

@@ -0,0 +1,375 @@
<template>
<view class="container">
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="top">
<view class="title">
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/icon_order.png" mode="aspectFill" />
<view>自提凭证</view>
</view>
</view>
<view class="card_item" v-if="orderInfo.status == 'waiting'">
<view>
<view class="code">提货码{{orderInfo.couponCode}}</view>
<tki-qrcode ref="tkiQrcode" show :size="qrcodeSize"></tki-qrcode>
</view>
<view class="semicircle_icon" >
<view class="semicircle_left_icon"></view>
<view class="semicircle_right_icon"></view>
</view>
</view>
<view class="card_item status" v-else>
<view class="status_left">
<view class="status_title">已使用</view>
<view class="status_code">{{orderInfo.couponCode}}</view>
</view>
<view class="status_qrcode" >
<image class="qrcode" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/qrcode.png" mode="aspectFill" />
<image class="status" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/status.png" mode="aspectFill" />
</view>
</view>
<view class="total-wrap">
<view class="info">
<u-icon name="map" color="#666" size="28"></u-icon>
<view class="shopName">自取店{{ shopUserInfo.shopName }}</view>
<!-- <u-icon name="phone" color="#666" size="28"></u-icon> -->
<view class="phone">{{shopUserInfo.telephone}}</view>
</view>
<view class="address">
<view class="lable">门店地址</view>
<view>{{shopUserInfo.address}}</view>
</view>
</view>
</view>
</view>
<view class="product">
<image class="thumbnail" :src="orderInfo.goodsImageUrl" mode="aspectFill" />
<view class="product_info">
<view class="name">{{orderInfo.pointsGoodsName}}</view>
<view class="numBox"><view class="points">{{orderInfo.spendPoints}}积分</view><view class="num">X1</view></view>
</view>
<!-- <view class="productInfo"></view> -->
</view>
<view class="orderInfo">
<view class="row">
<text class="t">支付方式</text>
<text class="info">{{orderInfo.payMethod}}</text>
</view>
<view class="row">
<text class="t">兑换时间</text>
<text class="info">{{orderInfo.createTime}}</text>
</view>
<view class="row" @click="copyHandle(orderInfo.orderNo)">
<text class="t">订单编号</text>
<text class="info">{{orderInfo.orderNo}}</text>
</view>
</view>
</view>
</template>
<script>
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
export default {
data() {
return {
qrcodeSize: 200,
shopId: null,
orderInfo: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
}
},
onLoad(options) {
console.log(JSON.parse(options.orderInfo))
if ( options.shopId ) {
this.shopId = options.shopId;
this.orderInfo = JSON.parse(options.orderInfo);
}
},
mounted() {
this.setQrcode();
},
methods: {
setQrcode () {
this.$refs.tkiQrcode.setval(this.orderInfo.couponCode) //操作属性
},
/**
* 复制订单号
* @param {Object} e
*/
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
}
}
</script>
<style lang="scss">
.container{
padding: 32rpx 20rpx;
}
.card_box{
background-color: #fff;
position: relative;
width: 100%;
height: 100%;
border-radius: 18rpx;
padding-bottom: 32rpx;
.card_head_box{
width: 100%;
display: flex;
justify-content: space-between;
position: absolute;
top: -22.5rpx;
padding: 0 44rpx;
.card_head_item{
width: 45rpx;
height: 45rpx;
background-color: #f9f9f9;
border-radius: 50%;
// box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
}
}
.card {
// background-color: #fff;
border-radius: 20upx;
margin-bottom: 28upx;
position: relative;
.top{
padding: 0 34rpx;
}
.title{
font-weight: 500;
font-size: 24rpx;
color: #333333;
border-bottom: 2rpx dashed #E3E3E3;
padding-bottom: 36rpx;
padding-top: 50rpx;
display: flex;
align-items: center;
.icon{
width: 25.45rpx;
height: 28.53rpx;
margin-right: 16rpx;
}
}
.card_item{
display: flex;
flex-direction: column;
position: relative;
padding: 32rpx 34rpx 48rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
align-items: center;
.code{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 48rpx;
}
::v-deep.vue-ref{
display: flex;
justify-content: center;
}
.semicircle_icon{
width: 100%;
position: absolute;
bottom: -22.5rpx;
left: 0;
display: flex;
justify-content: space-between;
.semicircle_left_icon{
width: 45rpx;
height: 45rpx;
margin-left: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
// box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
}
.semicircle_right_icon{
width: 45rpx;
height: 45rpx;
margin-right: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
// box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
}
}
}
.card_item.status{
display: flex;
flex-direction: row;
justify-content: space-between;
.status_left{
display: flex;
flex-direction: column;
justify-content: space-between;
.status_title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 24rpx;
}
.status_code{
text-decoration:line-through;
font-weight: bold;
font-size: 32rpx;
color: #999999;
}
}
.status_qrcode{
width: 112rpx;
height: 112rpx;
position: relative;
.qrcode{
width: 112rpx;
height: 112rpx;
}
.status{
width: 54.82rpx;
height: 48rpx;
position: absolute;
bottom: 0;
right: 0;
}
}
}
.total-wrap {
width: 100%;
display: flex;
flex-direction: column;
padding: 0 34rpx;
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 38rpx;
.info{
display: flex;
align-items: center;
font-weight: bold;
font-size: 24rpx;
color: #333333;
.shopName{
margin-right: 5rpx;
margin-left: 16rpx;
}
.phone{
margin-left: 16rpx;
}
}
.address{
margin-left: 36rpx;
align-self: center;
display: flex;
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin-top: 24rpx;
align-self: flex-start;
.lable{
flex-shrink: 0;
}
}
}
}
}
.product{
padding: 32rpx 34rpx;
background-color: #FFFFFF;
margin-top: 32rpx;
border-radius: 18rpx;
display: flex;
.thumbnail{
width: 152rpx;
height: 152rpx;
border-radius: 10rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.product_info{
width: 100%;
display: flex;
flex-direction: column;
margin-top: 15rpx;
.name{
font-weight: bold;
font-size: 24rpx;
color: #333333;
margin-bottom: 32rpx;
}
.numBox{
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 500;
font-size: 24rpx;
.points{
color: #F7853D;
}
.num{
color: #999999
}
}
}
}
.orderInfo{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin-top: 32rpx;
padding: 32rpx 34rpx;
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
.row {
display: flex;
justify-content: space-between;
margin-bottom: 32rpx;
.t {
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
}
.row:last-child{
margin-bottom: none;
}
}
</style>

View File

@@ -0,0 +1,118 @@
<template>
<view class="container">
<view class="top">
<image class="goodsImageUrl" :src="goodsData.goodsImageUrl" mode="aspectFill"/>
<view class="title">{{goodsData.goodsName}}</view>
<view class="pointsNum">{{goodsData.requiredPoints}}<view class="f"> 积分</view></view>
</view>
<view class="h"></view>
<view class="bom">
<view class="title">商品详情</view>
<view class="goodsDescription">{{goodsData.goodsDescription}}</view>
</view>
<view class="btn" @click="exchange">立即兑换</view>
</view>
</template>
<script>
export default {
data() {
return {
goodsData: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
shopId: null,
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
this.goodsData = JSON.parse(options.goodsData);
}
},
onShow() {
},
methods: {
/**
* 立即兑换
*/
exchange () {
uni.navigateTo({
url: `/pagesPoints/confirm_order/index?shopId=${this.shopId}&goodsData=${JSON.stringify(this.goodsData)}`,
})
},
}
};
</script>
<style>
page {
background-color: #fff!important;
}
</style>
<style scoped lang="scss">
.top{
display: flex;
flex-direction: column;
background-color: #fff;
padding-bottom: 32rpx;
.goodsImageUrl{
width: 100%;
height: 530rpx;
}
.title{
font-weight: bold;
font-size: 32rpx;
color: #1A1A1A;
padding: 32rpx 20rpx;
}
.pointsNum{
font-weight: bold;
font-size: 32rpx;
color: #333333;
display: flex;
align-items: flex-end;
padding: 0 20rpx;
.f{
font-weight: normal;
font-size: 24rpx;
}
}
}
.h{
width: 100%;
height: 14rpx;
background-color: #f9f9f9;
}
.bom{
padding: 32rpx 20rpx;
background-color: #fff;
.title{
font-weight: bold;
font-size: 32rpx;
color: #1A1A1A;
}
.goodsDescription{
font-weight: 400;
font-size: 28rpx;
color: #1A1A1A;
margin-top: 32rpx;
}
}
.btn{
width: 556rpx;
height: 84rpx;
line-height: 84rpx;
text-align: center;
background: #E8AD7B;
border-radius: 49rpx 49rpx 49rpx 49rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
position: fixed;
bottom: 68rpx;
left: 0;
right: 0;
margin: auto;
}
</style>

349
pagesPoints/index/index.vue Normal file
View File

@@ -0,0 +1,349 @@
<template>
<view class="container">
<view class="head_bg"></view>
<view class="info">
<view class="info_content">
<image class="img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/points_img1.png" mode="aspectFill"/>
<viwe class="tips">可用积分</viwe>
<viwe class="pnintsNum">{{pointsInfo.accountPoints}}</viwe>
<viwe class="bottom">
<view @click="tapClick(item)" v-for="(item,index) in tap" :key="index">
<image class="icon" :src="item.iconUrl" mode="aspectFill" />
<view>{{item.name}}</view>
</view>
</viwe>
</view>
</view>
<view class="list"
:class="{
column: shopSettingInfo.browseMode == 'list',
row: shopSettingInfo.browseMode == 'grid'
}"
>
<view class="listItem"
:class="{
row: shopSettingInfo.browseMode == 'list',
column: shopSettingInfo.browseMode == 'grid'
}"
v-for="(item,index) in list" :key="index"
@click="goDetail(item)"
>
<image class="img" :src="item.goodsImageUrl" mode="aspectFill"/>
<view class="itemInfo">
<view class="title">{{item.goodsName}}</view>
<view class="remainingNum" v-if="shopSettingInfo.browseMode == 'list'">剩余{{item.quantity}}</view>
<view class="bottom">
<view class="pointsNum">{{item.requiredPoints}}<view class="f">积分</view></view>
<view class="btn" @click.stop="exchange(item)" v-if="shopSettingInfo.browseMode == 'list'">立即兑换</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
tap: [
{name: '积分明细', pageUrl: "/pagesPoints/IntegralDetail/index", iconUrl: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/icon_detail.png"},
{name: '兑换记录', pageUrl: "/pagesPoints/exchangeRecord/index", iconUrl: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/icon_record.png"}
],
query: {
page: 1,
size: 10,
},
list: [],
shopSettingInfo: null,
pointsInfo: null,
shopUserInfo: null,
shopId: null,
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
},
onShow() {
this.getShopSettingInfo()
this.getShopInfo()
this.getointsGoodsList()
},
methods: {
/**
* 获取会员信息
*/
async getShopInfo() {
let res = await this.api.shopUserInfo({
shopId: this.shopId,
userId: uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
uni.cache.set('shopUserInfo',this.shopUserInfo)
this.getmemberPointsInfo(this.shopUserInfo.id)
}
},
/**
* 获取店铺设置
*/
async getShopSettingInfo() {
let res = await this.api.shopSettingInfo(this.shopId)
if (res.code == 0) {
this.shopSettingInfo = res.data;
}
},
/**
* 获取会员积分
*/
async getmemberPointsInfo (memberId) {
let res = await this.api.memberPointsInfo(memberId)
if (res.code == 0) {
this.pointsInfo = res.data;
}
},
/**
* 获取积分商品列表
*/
async getointsGoodsList() {
let res = await this.api.pointsGoodsList({
shopId: this.shopId,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
// this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
},
/**
* 跳转详情
* @param {Object} item
*/
goDetail (item) {
uni.navigateTo({
url: `/pagesPoints/goodsDetail/index?shopId=${this.shopId}&goodsData=${JSON.stringify(item)}`,
})
},
/**
* 积分明细兑换记录跳转
*/
tapClick (item) {
uni.pro.navigateTo(item.pageUrl, {
shopId: this.shopId,
})
},
/**
* 立即兑换
*/
async exchange (item) {
uni.navigateTo({
url: `/pagesPoints/confirm_order/index?shopId=${this.shopId}&goodsData=${JSON.stringify(item)}`,
})
}
}
};
</script>
<style scoped lang="scss">
page {
// background: #f6f6f6;
}
.head_bg{
height: 256rpx;
background: linear-gradient(180deg, #E9B183 0%, #F5F5F500 100%);
position: absolute;
left: 0;
right: 0;
top: 0;
margin: auto;
}
.info{
padding: 32rpx 20rpx;
position: relative;
z-index: 2;
.info_content{
background: #FFFFFF;
box-shadow: 0rpx 6rpx 8rpx 2rpx rgba(0,0,0,0.09);
border-radius: 24rpx 24rpx 24rpx 24rpx;
padding: 32rpx;
display: flex;
flex-direction: column;
position: relative;
.img{
width: 152rpx;
height: 186rpx;
position: absolute;
top: 0;
right: 0;
}
.tips{
font-weight: 500;
font-size: 24rpx;
color: #666666;
margin-bottom: 32rpx;
}
.pnintsNum{
font-weight: bold;
font-size: 60rpx;
color: #333333;
}
.bottom{
font-weight: 400;
font-size: 26rpx;
color: #333333;
display: flex;
align-items: center;
justify-content: space-around;
border-top: 1rpx solid #E5E5E5;
padding-top: 24rpx;
margin-top: 24rpx;
position: relative;
z-index: 9;
>view{
width: 50%;
display: flex;
align-items: center;
justify-content: center;
.icon{
width: 30rpx;
height: 30rpx;
margin-right: 4rpx;
}
}
>view:nth-child(1){
border-right: 1rpx solid #E5E5E5
}
}
}
}
.list{
padding: 0 20rpx 0 20rpx;
position: relative;
z-index: 2;
display: flex;
flex-wrap: wrap;
.listItem{
display: flex;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 32rpx 16rpx;
margin-bottom: 32rpx;
.img{
flex-shrink: 0;
border-radius: 10rpx;
}
.itemInfo{
width: 100%;
display: flex;
flex-direction: column;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 10rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.remainingNum{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 20rpx;
}
.bottom{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
}
.pointsNum{
font-weight: bold;
font-size: 32rpx;
color: #333333;
display: flex;
align-items: flex-end;
.f{
font-weight: normal;
font-size: 24rpx;
}
}
.btn{
width: 180rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E8AD7B;
border-radius: 34rpx 34rpx 34rpx 34rpx;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
.listItem.row{
width: 100%;
.img{
width: 160rpx;
height: 160rpx;
margin-right: 16rpx;
}
}
.listItem.column{
width: 45%;
.img{
width: 100%;
height: 224rpx;
}
.title{
margin-top: 16rpx;
margin-bottom: 10rpx;
}
}
}
.row{
flex-direction: row;
justify-content: space-between;
}
.column{
flex-direction: column;
}
</style>