积分兑换

This commit is contained in:
liuye
2023-04-13 16:26:56 +08:00
parent fe9ff22748
commit 94d54f85fd
6 changed files with 270 additions and 124 deletions

View File

@@ -4,7 +4,7 @@
<div class="header">
<div class="num">
<p>积分余额</p>
<h3>562</h3>
<h3>{{total}}</h3>
</div>
<div class="btn" @click="toMyOrder">我的订单</div>
</div>
@@ -23,8 +23,8 @@
</div>
</div>
</div>
<div class="list-content">
<u-waterfall v-model="flowList">
<div class="list-content" v-if="goodsList.length">
<u-waterfall v-model="goodsList">
<template v-slot:left="{leftList}">
<div v-for="(item, index) in leftList" :key="index" @click="toProductDetail(item)">
<div class="item">
@@ -33,33 +33,37 @@
<div class="content">
<p class="text">{{item.title}}</p>
<div class="item-money">
<h3>50积分</h3>
<p>+2.00</p>
<span>兑换后再付</span>
<h3>{{item.integralPrice}}积分</h3>
<p v-if="item.type == 1">+{{item.payMoney}}</p>
<span v-if="item.type == 1">兑换后再付</span>
</div>
<div class="btn btn0">去兑换</div>
<div class="btn" :class="total >= item.integralPrice ? 'btn1' : 'btn0'" @click.stop="toOrder(item)" v-if="item.status == 1 && item.stock > 0">{{total >= item.integralPrice ? '去兑换' : '积分不足'}}</div>
<div class="btn btn0" :class="`btn`+item.status" v-else>商品缺货</div>
</div>
</div>
</div>
</template>
<template v-slot:right="{rightList}">
<div v-for="(item, index) in rightList" :key="index">
<div v-for="(item, index) in rightList" :key="index" @click="toProductDetail(item)">
<div class="item">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/watermark/8.png" alt="">
<div class="type type0">京东低价商品</div>
<img :src="item.picUrl" alt="">
<div class="type" :class="`type`+item.type">{{ $dict.getLabel('integralSGType', item.type) }}</div>
<div class="content">
<p class="text">无染(wuro)本色抽纸无染(wuro)本色抽纸无无染(wuro)本色抽纸无染(wuro)本色抽</p>
<p class="text">{{item.title}}</p>
<div class="item-money">
<h3>50积分</h3>
<h3>{{item.integralPrice}}积分</h3>
<p v-if="item.type == 1">+{{item.payMoney}}</p>
<span v-if="item.type == 1">兑换后再付</span>
</div>
<div class="btn btn0">去兑换</div>
<div class="btn" :class="total >= item.integralPrice ? 'btn1' : 'btn0'" @click.stop="toOrder(item)" v-if="item.status == 1 && item.stock > 0">{{total >= item.integralPrice ? '去兑换' : '积分不足'}}</div>
<div class="btn btn0" :class="`btn`+item.status" v-else>商品缺货</div>
</div>
</div>
</div>
</template>
</u-waterfall>
</div>
<!-- <AiEmpty v-else></AiEmpty> -->
<AiEmpty v-else></AiEmpty>
</div>
</template>
@@ -86,25 +90,45 @@ export default {
currentPoint: 0,
leftList: [],
rightList: [],
flowList: [],
goodsList: [],
total: 0
}
},
computed: {
...mapState(['user']),
},
onLoad() {
this.getToatl()
this.$dict.load(['integralSGType']).then(() => {
this.getList()
})
},
methods: {
getToatl() {
this.$instance.post(`/app/appintegraluser/integralUserInfoFD`).then(res => {
if (res?.data) {
this.total = res.data.integral || 0
}
})
},
getListInit() {
this.goodsList = []
this.leftList = []
this.rightList = []
this.current = 1
},
getList() {
this.$instance.post(`/app/appintegralsupermarketshop/goodsListXCX`).then(res => {
this.$instance.post(`/app/appintegralsupermarketshop/goodsListXCX`, null, {
params: {
goodsType: this.currentTabs, //商品类型0全部、1免费兑、2京东低价商品默认0
orderType: this.currentType == 0 ? 1 : 0, //排序类型0积分升序、1上架时间倒序默认0
filterIntegral: this.currentType == 2 ? true : false, //过滤我可兑换的默认false
integralRange: this.currentType == 1 ? this.currentPoint : '', //积分区间类型0全部、150分以下、2:100分以下、3200分以下、45000分以下默认0
current: this.current
}
}).then(res => {
if (res.code === 0) {
this.flowList = res.data.records
this.goodsList = this.current == 1 ? res.data.records : [...this.goodsList, ...res.data.records]
if(res.data && res.data.records.length) {
res.data.records.map((item, index) => {
if(index%2 == 0) {
@@ -119,26 +143,31 @@ export default {
},
changeTab(index) {
this.currentTabs = index
// this.getListInit()
this.getListInit()
},
typeClick(index) {
this.currentType = index
// this.getListInit()
this.getListInit()
},
pointClick(index) {
this.currentPoint = index
// this.getListInit()
this.getListInit()
},
toProductDetail(item) {
uni.navigateTo({url: `./productDetails?id=${item.id}`})
uni.navigateTo({url: `./productDetails?shopGoodsId=${item.shopGoodsId}&total=${this.total}`})
},
toMyOrder() {
uni.navigateTo({url: './myOrderList'})
},
toOrder(item) {
if(this.total >= item.integralPrice && item.stock > 0) {
uni.navigateTo({url: `./placeOrder?shopGoodsId=${item.shopGoodsId}&total=${this.total}&backLevel=2`})
}
},
},
onReachBottom() {
// this.current = this.current + 1
// this.getList()
this.current = this.current + 1
this.getList()
},
}
</script>
@@ -228,6 +257,8 @@ export default {
img {
width: 100%;
height: 340px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
}
.type {
padding: 8px 16px;
@@ -301,11 +332,11 @@ export default {
bottom: 24px;
right: 16px;
}
.btn0 {
.btn1 {
background-color: #2D7DFF;
color: #FFF;
}
.btn1 {
.btn0 {
background-color: #E2E2E2;
color: #666;
}

View File

@@ -0,0 +1,20 @@
<template>
<div class="jdH5">
<web-view :src="goodsJdUrl"></web-view>
</div>
</template>
<script>
export default {
name: 'jdH5',
data() {
return {
goodsJdUrl: ''
}
},
onLoad(option) {
this.goodsJdUrl = option.goodsJdUrl
},
}
</script>

View File

@@ -4,36 +4,37 @@
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="90" font-size="28" bg-color="#fff" inactive-color="#8891A1"
active-color="#1D2229 " :bar-style="barStyle" @change="changeTab" ></u-tabs>
</div>
<div class="list-content">
<div class="item">
<div class="list-content" v-if="list.length">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="time-flex">
<p>2022-05-25 17:45</p>
<div>已完成</div>
<p>{{item.createTime.substring(0, 16)}}</p>
<div :class="`status`+item.status">{{ $dict.getLabel('integralSGOStatus', item.status) }}</div>
</div>
<div class="flex">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/watermark/8.png" alt="">
<div class="type type0"><p>京东低价商品</p></div>
<img :src="item.goodsPicUrl" alt="">
<div class="type" :class="`type`+item.type">{{ $dict.getLabel('integralSGType', item.type) }}</div>
<div class="flex-right">
<p>无染(wuro)本色抽纸无染(wuro)本色抽纸无染(wuro)无染(wuro)本色抽纸无染无染(wuro)本色抽纸无染(wuro)本色抽纸无染(wuro)无染(wuro)</p>
<p>{{item.goodsTitle}}</p>
<div class="num-flex">
<h3>50积分<span>+2</span></h3>
<div>x 1</div>
<h3>{{item.usedIntegral}}积分<span v-if="item.type == 1">+{{item.payMoney}}</span></h3>
<div>x {{item.quantity}}</div>
</div>
</div>
</div>
<p class="tips"><span>兑换成功后点击去购买前往京东低价购买</span></p>
<p class="remark">备注不太好用不太好用不太好用不太好用不太好用不太好用不太好用不太好用不太好用不太好用不太好用</p>
<div class="flex-btn">
<p>核销码:<span>58555</span></p>
<div class="btn">取消订单</div>
</div>
<div class="flex-btn">
<p class="tips" v-if="item.type == 1"><span>兑换成功后点击去购买前往京东低价购买</span></p>
<p class="tips" v-else>免费兑换商品可到固定的兑换点进行核销兑换</p>
<p class="remark" v-if="item.remarks">备注{{item.remarks}}</p>
<div class="flex-btn" v-if="item.type == 1">
<p></p>
<div class="btn confirm">去购买</div>
<div class="btn confirm" @click="openJd(item)">去购买</div>
</div>
<div class="flex-btn" v-else>
<p>核销码:<span>{{item.verificationCode}}</span></p>
<div class="btn" v-if="item.status == 0" @click="cancel(item)">取消订单</div>
</div>
</div>
</div>
<!-- <AiEmpty v-else></AiEmpty> -->
<AiEmpty v-else></AiEmpty>
</div>
</template>
@@ -54,23 +55,65 @@ export default {
'bottom': '3px',
'background': '#2D7DFF'
},
list: [],
current: 1
}
},
computed: {
...mapState(['user']),
},
onLoad() {
this.$dict.load(['integralSGOStatus', 'integralSGType']).then(() => {
this.getList()
})
},
methods: {
changeTab(index) {
this.currentTabs = index
// this.getListInit()
this.getListInit()
},
getListInit() {
this.current = 1
this.getList()
},
getList() {
this.$instance.post(`/app/appintegralsupermarketorder/listForXCX`, null, {
params: {
current: this.current,
status: this.currentTabs == 0 ? '' : this.currentTabs - 1
}
}).then(res => {
if (res.code === 0) {
this.list = this.current == 1 ? res.data.records : [...this.list, ...res.data.records]
}
})
},
openJd(item) {
uni.navigateTo({url: `./jdH5?goodsJdUrl=${item.goodsJdUrl}`})
},
cancel(item) {
uni.showModal({
title: '确认取消该订单?',
confirmspan: "确认",
confirmColor: "#135AB8",
success: function (res) {
if (res.confirm) {
this.cancelOrder(item)
}
}
});
},
cancelOrder(item) {
this.$instance.post(`/app/appintegralsupermarketorder/cancelForXCX?id=${item.id}`).then(res => {
if (res.code === 0) {
this.getListInit()
}
})
},
},
onReachBottom() {
// this.current = this.current + 1
// this.getList()
this.current = this.current + 1
this.getList()
},
}
</script>
@@ -104,6 +147,9 @@ export default {
div {
color: #2D7DFF;
}
.status2 {
color: #999;
}
}
.flex {
padding: 32px 32px 0;
@@ -132,10 +178,10 @@ export default {
scale: 0.9;
}
}
.type0 {
.type1 {
background-color: #E64E39;
}
.type1 {
.type0 {
background-color: #FF6900;
}
.flex-right {

View File

@@ -2,34 +2,35 @@
<div class="placeOrder">
<div class="header-info">
<div class="flex">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/watermark/8.png" alt="">
<div class="type type0"><p>京东低价商品</p></div>
<img :src="goodsInfo.picUrl" alt="">
<div class="type" :class="`type`+goodsInfo.type">{{ $dict.getLabel('integralSGType', goodsInfo.type) }}</div>
<div class="flex-right">
<p>无染(wuro)本色抽纸无染(wuro)本色抽纸无染(wuro)无染(wuro)本色抽纸无染无染(wuro)本色抽纸无染(wuro)本色抽纸无染(wuro)无染(wuro)</p>
<p>{{goodsInfo.title}}</p>
<div>
<u-number-box v-model="value" @change="valChange" input-height="44" size="24" :min="1" :max="100"></u-number-box>
<u-number-box v-model="goodsNum" @change="valChange" input-height="44" size="24" :min="1" :max="goodsInfo.stock"></u-number-box>
</div>
<h3>50积分<span>+2.00</span></h3>
<h3>{{goodsInfo.integralPrice}}积分<span v-if="goodsInfo.type == 1">+{{goodsInfo.payMoney}}.00</span></h3>
</div>
</div>
<p class="tips"><span>兑换成功后点击去购买前往京东低价购买</span></p>
<p class="tips" v-if="goodsInfo.type == 1">兑换成功后点击去购买前往京东低价购买</p>
<p class="tips" v-else>免费兑换商品可到固定的兑换点进行核销兑换</p>
</div>
<div class="content">
<div class="item-flex" @click="show=true">
<div class="label">订单备注</div>
<div class="value color-999">无备注<u-icon name="arrow-right" color="#bbb" size="24"></u-icon></div>
<div class="value" :class="value ? '' : 'color-999'">{{value || '无备注'}}<u-icon name="arrow-right" color="#bbb" size="24"></u-icon></div>
</div>
<div class="item-flex">
<div class="label">积分余额</div>
<div class="value color-FF6900">562积分</div>
<div class="value color-FF6900">{{total}}积分</div>
</div>
<div class="item-flex">
<div class="label">支付积分</div>
<div class="value">100积分</div>
<div class="value">{{goodsNum*goodsInfo.integralPrice}}积分</div>
</div>
<div class="item-flex">
<div class="item-flex" v-if="goodsInfo.type == 1">
<div class="label">京东支付</div>
<div class="value color-999">¥4.00</div>
<div class="value color-999">¥{{goodsNum*goodsInfo.payMoney}}</div>
</div>
</div>
<u-popup v-model="show" mode="bottom">
@@ -42,7 +43,7 @@
<span class="confirm" @click="confirm">保存</span>
</div>
</u-popup>
<div class="bottom-btn" @click="toSuccess()">
<div class="bottom-btn" @click="confirmOrder()">
<div>提交订单</div>
</div>
</div>
@@ -56,28 +57,56 @@ export default {
appName: '提交订单',
data() {
return {
value: 1,
show: false
value: '',
show: false,
total: 0,
goodsInfo: {},
goodsNum: 1,
backLevel: 0
}
},
computed: {
...mapState(['user']),
},
onLoad() {
onLoad(option) {
this.shopGoodsId = option.shopGoodsId
this.total = option.total
this.backLevel = option.backLevel
this.$dict.load(['integralSGType']).then(() => {
this.getDetail()
})
},
methods: {
getDetail() {
this.$instance.post(`/app/appintegralsupermarketshop/queryGoodsInfoXCX?shopGoodsId=${this.shopGoodsId}`).then(res => {
if (res.code === 0) {
this.goodsInfo = res.data
}
})
},
valChange(e) {
console.log('当前值为: ' + e.value)
this.goodsNum = e.value
},
confirm() {
this.show = false
},
confirmOrder() {
this.$instance.post(`/app/appintegralsupermarketorder/add`, {
shopId: this.goodsInfo.shopId,
goodsId: this.goodsInfo.id,
remarks: this.value,
quantity: this.goodsNum
}).then(res => {
if (res.code === 0) {
this.toSuccess()
}
})
},
toSuccess() {
uni.navigateTo({url: './successOrder'})
var integralPrice = this.goodsNum*this.goodsInfo.integralPrice
uni.navigateTo({url: `./successOrder?isFree=${this.goodsInfo.type}&integralPrice=${integralPrice}&backLevel=${this.backLevel}&goodsJdUrl=${this.goodsInfo.goodsJdUrl}`})
}
},
onReachBottom() {
// this.current = this.current + 1
// this.getList()
},
}
</script>
@@ -113,10 +142,10 @@ export default {
scale: 0.9;
}
}
.type0 {
.type1 {
background-color: #E64E39;
}
.type1 {
.type0 {
background-color: #FF6900;
}
.flex-right {

View File

@@ -1,25 +1,21 @@
<template>
<div class="productDetails">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/watermark/8.png" alt="">
<div class="type type0">免费兑</div>
<div class="productDetails" v-if="goodsInfo.picUrl">
<img :src="goodsInfo.picUrl" alt="">
<div class="type" :class="`type`+goodsInfo.type">{{ $dict.getLabel('integralSGType', goodsInfo.type) }}</div>
<div class="product-info">
<p>无染(wuro)本色抽纸无染(wuro)本色抽纸无染(wuro)本色抽纸无染(wuro)本色抽纸</p>
<h3>50积分<span>+2.00<span>兑换后再付</span></span></h3>
<div>零售单价¥10.00</div>
<span class="tips">免费兑换商品可到固定的兑换点进行核销兑换</span>
<p>{{goodsInfo.title}}</p>
<h3>{{goodsInfo.integralPrice}}积分<span v-if="goodsInfo.type == 1">+¥{{goodsInfo.payMoney}}<span v-if="goodsInfo.type == 1">兑换后再付</span></span></h3>
<div>零售单价¥{{goodsInfo.retailPrice}}</div>
<span class="tips" v-if="goodsInfo.type == 1">兑换成功后点击去购买前往京东低价购买</span>
<span class="tips" v-else>免费兑换商品可到固定的兑换点进行核销兑换</span>
</div>
<div class="product-content">
<p>商品描述</p>
<p>本色最早起源于南朝刘勰文心雕龙_
蟹悬架于栗龍登花文温襞垄总理寿事集色一
做过解释本色就是求真特别较真有时候有点犟泉林本色对本色的解释是对于生活是一种健康环保的生活观念
泉林本色是公司在长期的发展过程中逐渐打造的高端产品产品主要是涉岌泉秣本色生活角箱浆纸产品种美包括软箱面巾纸
盒抽面巾纸卷纸空心卷纸实心卷纸扁卷纸手帕纸饕币纸珍宝纸擦手纸礼品套装等种类齐全在各个生活
的细微之处全面呵护消费者的健康
</p>
<p v-html="goodsInfo.description"></p>
</div>
<div class="btn" @click="toPlaceOrder()">
<div class="status0">立即兑换</div>
<div class="btn" @click="toOrder()">
<div :class="total >= goodsInfo.integralPrice ? 'status1' : 'status0'" v-if="goodsInfo.status == 1 && goodsInfo.stock > 0">{{total >= goodsInfo.integralPrice ? '去兑换' : '积分不足'}}</div>
<div class="status0" v-else>商品缺货</div>
</div>
</div>
</template>
@@ -32,23 +28,34 @@ export default {
appName: '兑换商品',
data() {
return {
shopGoodsId: '',
goodsInfo: {},
total: 0
}
},
computed: {
...mapState(['user']),
},
onLoad() {
onLoad(option) {
this.shopGoodsId = option.shopGoodsId
this.total = option.total
this.$dict.load(['integralSGType']).then(() => {
this.getDetail()
})
},
methods: {
toPlaceOrder() {
uni.navigateTo({url: './placeOrder'})
getDetail() {
this.$instance.post(`/app/appintegralsupermarketshop/queryGoodsInfoXCX?shopGoodsId=${this.shopGoodsId}`).then(res => {
if (res.code === 0) {
this.goodsInfo = res.data
}
})
},
toOrder() {
if(this.total >= this.goodsInfo.integralPrice && this.goodsInfo.stock > 0 && this.goodsInfo.status == 1) {
uni.navigateTo({url: `./placeOrder?shopGoodsId=${this.goodsInfo.shopGoodsId}&total=${this.total}&backLevel=3`})
}
},
onReachBottom() {
// this.current = this.current + 1
// this.getList()
},
}
</script>
@@ -73,10 +80,10 @@ export default {
padding: 16px 16px 16px 36px;
border-bottom-left-radius: 40px;
}
.type0 {
.type1 {
background-color: #E64E39;
}
.type1 {
.type0 {
background-color: #FF6900;
}
.product-info {
@@ -158,11 +165,11 @@ export default {
font-weight: 500;
font-size: 34px;
}
.status0 {
.status1 {
color: #FFF;
background: #4181FF;
}
.status1 {
.status0 {
color: #666;
background: #E2E2E2;
}

View File

@@ -1,20 +1,21 @@
<template>
<div class="successOrder">
<img src="./img/success.png" alt="">
<div v-if="isOrder">
<h3>提交成功</h3>
<p>提交免费兑订单成功扣减 <span>50积分</span></p>
<div class="btn-flex">
<div>返回</div>
<div>查看订单</div>
</div>
</div>
<div v-else>
<div v-if="isFree == 1">
<h3>兑换成功</h3>
<p>提交京东低价商品订单成功扣减 <span>50积分</span>
<p>提交京东低价商品订单成功扣减 <span>{{integralPrice}}积分</span>
可点击下方按钮前往京东商城进行低价购买
</p>
<div class="btn">去购买</div>
<div class="btn" @click="openJd">去购买</div>
</div>
<div v-else>
<h3>提交成功</h3>
<p>提交免费兑订单成功扣减 <span>{{integralPrice}}积分</span></p>
<div class="btn-flex">
<div @click="back">返回</div>
<div @click="toOrderList">查看订单</div>
</div>
</div>
</div>
</template>
@@ -27,21 +28,33 @@ export default {
appName: '提交订单',
data() {
return {
isOrder: false
isFree: 0, // 0免费 1京东
integralPrice: 0,
backLevel: 1,
goodsJdUrl: ''
}
},
computed: {
...mapState(['user']),
},
onLoad() {
onLoad(option) {
this.isFree = option.isFree
this.integralPrice = option.integralPrice
this.backLevel = option.backLevel
this.goodsJdUrl = option.goodsJdUrl
},
methods: {
openJd() {
uni.navigateTo({url: `./jdH5?goodsJdUrl=${this.goodsJdUrl}`})
},
onReachBottom() {
// this.current = this.current + 1
// this.getList()
back() {
uni.navigateBack({delta: backLevel})
},
toOrderList() {
uni.redirectTo({
url: './myOrderList'
})
}
},
}
</script>