6
0
Fork 0

积分当钱花

develop
Jing Li 2023-10-17 19:36:32 +08:00
parent abe11de5df
commit c4f47b20a1
10 changed files with 104 additions and 304 deletions

View File

@ -42,9 +42,10 @@
<block >
<view class="flex items-center justify-between mt-30rpx">
<view>回复</view>
<block v-if="detail.type==1||detail.type==2">
<view v-if="detail.state==3 || detail.state==4 ||detail.state==5" class="text-hex-d43030">退{{detail.amount}}</view>
</block>
<view v-if="detail.type==1||detail.type==2" class="flex">
<view v-if="detail.state==3 || detail.state==4 ||detail.state==5" class="text-hex-d43030">{{detail.amount}}</view>
<view v-if="(detail.state==3 || detail.state==4 ||detail.state==5) && detail.points > 0" class="ml-20rpx text-hex-d43030">{{detail.points}}</view>
</view>
</view>
<view class="mt-base">{{detail.remarks?detail.remarks:'资料已提交,请耐心等待客服审核'}}</view>
</block>

View File

@ -283,22 +283,6 @@
"enablePullDownRefresh": false,
"navigationStyle": "default"
}
},
{
"path": "pages/points/swap",
"style": {
"navigationBarTitleText": "积分兑换",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/points/swap-record",
"style": {
"navigationBarTitleText": "我的兑换",
"enablePullDownRefresh": false,
"navigationStyle": "default"
}
}
],
"subPackages": [{

View File

@ -97,10 +97,6 @@
</view>
<!-- -->
<view class="bg-white mt-base rounded-xs pb-base px-40rpx pt-rowSm text-md">
<view class="flex items-center justify-between py-rowSm text-txBase" v-if="orderInfo.total_points>0">
<view>抵扣积分</view>
<view>{{ orderInfo.total_points }}</view>
</view>
<view class="flex items-center justify-between py-rowSm text-txBase">
<view>商品金额</view>
<view>{{ orderInfo.products_total_amount }}</view>
@ -121,10 +117,22 @@
<view>砍价优惠</view>
<view class="text-bgSubtitle">-{{ orderInfo.bargain_amount }}</view>
</view>
<view v-if="orderInfo.total_amount > 0" class="flex items-center justify-between py-rowSm text-txBase">
<view>积分<block v-if="hasRemainingPoints">({{ orderInfo.remaining_points }})</block></view>
<view v-if="hasRemainingPoints" class="flex items-center" @tap="openPointDiscountDrawer">
<view v-if="pointDiscount.amount > 0" class="text-bgSubtitle">-{{ pointDiscount.amount }}</view>
<view v-else></view>
<u-icon name="arrow-right" size="20" class="ml-10rpx text-gray-400"></u-icon>
</view>
<view v-else class="flex items-center text-gray-400">
<view>无可用</view>
<u-icon name="arrow-right" size="20" class="ml-10rpx text-gray-400"></u-icon>
</view>
</view>
<!-- -->
<view class="text-md border-t border-txBorder flex items-center justify-end py-base">
<view class="text-txBase">实付金额</view>
<view class="text-bgSubtitle">{{ orderInfo.total_amount }}</view>
<view class="text-bgSubtitle">{{ paymentAmount }}</view>
</view>
<!-- -->
<view class="border-t border-txBorder pt-base text-md">
@ -154,12 +162,35 @@
</view>
</cu-popup>
<cu-popup v-model="showPointDiscountDrawer" mode="bottom" border-radius="20" closeable close-icon-size="24">
<view>
<view class="flex p-50rpx text-x-lg items-end">积分<view class="text-md text-txBase">剩余: {{ orderInfo.remaining_points }}</view></view>
<scroll-view scroll-y="true" class="min-h-600rpx max-h-900rpx">
<view class="text-md flex justify-between px-50rpx py-base" @tap="selectPointDiscountOption(0)">
<view>暂不使用积分</view>
<u-icon name="checkmark-circle" :color="pointDiscountSelectedOption.value == 0 ? '#f43530' : '#808080'" size="40"></u-icon>
</view>
<view class="text-md flex justify-between px-50rpx py-base" @tap="selectPointDiscountOption(1)">
<view class="flex">
抵扣<view class="mx-8rpx text-bgSubtitle">{{ orderInfo.point_discount_amount }}</view>使用<view class="mx-8rpx">{{ orderInfo.available_points }}</view>积分
</view>
<u-icon name="checkmark-circle" :color="pointDiscountSelectedOption.value == 1 ? '#f43530' : '#808080'" size="40"></u-icon>
</view>
</scroll-view>
<view class="p-base">
<view class="btn bg-hex-FB4A34 h-84rpx leading-84rpx text-white" @tap="submitPointDiscount">
<text>确定</text>
</view>
</view>
</view>
</cu-popup>
<!-- -->
<view class="h-130rpx"></view>
<!-- -->
<view class="flex items-center justify-end bg-white shadow-up fixed right-0 left-0 bottom-0 cu-bar tabbar">
<view class="text-md text-txBase">
合计: <text class="text-xl" v-if="orderInfo.total_points >0"> {{orderInfo.total_points}}积分+</text> <text class="text-xl text-txSvip">{{ orderInfo.total_amount }}</text>
合计: <text class="text-xl text-txSvip">{{ paymentAmount }}</text>
</view>
<view @tap="createOrder" class="w-180rpx h-66rpx leading-66rpx text-center text-lg ml-40rpx text-white bg-primary rounded-lg mr-base">提交订单</view>
<view v-if="is_company && type != 'desk'" @tap="createPreOrder" class="w-180rpx h-66rpx leading-66rpx text-center text-lg ml-20rpx text-white bg-hex-D43030 rounded-lg mr-base"></view>
@ -169,7 +200,7 @@
<script>
let btnLoading = false;
import { add } from '@/utils'
import { sub } from '@/utils'
export default {
data() {
return {
@ -198,6 +229,21 @@
desk: '',
// id
mid: '',
//--------------------------
//
//--------------------------
pointDiscount: {
value: null,
points: 0,
amount: 0,
},
showPointDiscountDrawer: false,
pointDiscountSelectedOption: {
value: null,
points: 0,
amount: 0,
},
};
},
async onLoad(options) {
@ -273,7 +319,14 @@
//
is_company() {
return this.user?.is_company ?? false
}
},
//
hasRemainingPoints() {
return this.orderInfo.remaining_points > 0
},
paymentAmount() {
return sub(this.orderInfo.total_amount ?? 0, this.pointDiscount.amount ?? 0)
},
},
onShow() {
if (this.goods.length > 0 || this.cards.length > 0) {
@ -299,6 +352,7 @@
coupon_id: couponId,
shipping_address_id: addressId,
note: remarks,
points: this.pointDiscount.points,
};
if(this.type == 'points'){
@ -384,6 +438,33 @@
if(this.couponsList.length==0) return this.$u.toast('当前无可用优惠券')
this.couponShow = true
},
openPointDiscountDrawer() {
this.pointDiscountSelectedOption = this.pointDiscount
this.showPointDiscountDrawer = true
},
selectPointDiscountOption(value) {
switch (value) {
case 0:
this.pointDiscountSelectedOption = {
value: 0,
points: 0,
amount: 0,
}
break;
case 1:
this.pointDiscountSelectedOption = {
value: 1,
points: this.orderInfo.available_points,
amount: this.orderInfo.point_discount_amount,
}
break;
}
},
submitPointDiscount() {
this.pointDiscount = this.pointDiscountSelectedOption
this.showPointDiscountDrawer = false
},
//
addressUpdate({id}) {
this.addressId = id;

View File

@ -35,13 +35,9 @@
<!-- <view @tap="copy" class="">复制</view> -->
</view>
</view>
<view class="flex items-center justify-between mt-20rpx text-txBase text-lg">
<view class="flex-1" v-if="walletShow">: <text class="font-medium">{{ balance.balance }}</text></view>
<!-- <view class="w-200rpx flex-none">
<view class="" v-if="!isVerify"
>积分:<text class="font-medium">{{ user.points }}</text></view
>
</view> -->
<view class="flex items-center justify-between mt-10rpx text-txBase text-lg">
<!-- <view class="flex-1" v-if="walletShow">: <text class="font-medium">{{ balance.balance }}</text></view> -->
<view class="flex-1" @tap="$u.routeAuth('/pages/points/record')">: <text class="font-medium">{{ user.points }}</text></view>
</view>
<!-- <view>
<view class="flex">

View File

@ -113,10 +113,6 @@
</block>
<view v-if="detail.note" class="bg-hex-F5F2F2 p-rowSm mt-base h-100rpx text-md text-hex-808080"> {{ detail.note }} </view>
<view class="mt-20rpx">
<view class="h-50rpx leading-50rpx flex justify-between" v-if="detail.total_points > 0">
<text class="text-black">抵扣积分</text>
<text>{{ detail.total_points }}</text>
</view>
<view class="h-50rpx leading-50rpx flex justify-between">
<text class="text-black">商品金额</text>
<text>{{ detail.products_total_amount }}</text>
@ -137,6 +133,10 @@
<text class="text-black">砍价优惠</text>
<text class="text-warning">-{{ detail.bargain_amount }}</text>
</view>
<view class="h-50rpx leading-50rpx flex justify-between" v-if="detail.point_discount_amount > 0">
<text class="text-black">积分</text>
<text class="text-warning">-{{ detail.point_discount_amount }}</text>
</view>
</view>
<u-line color="#E5E5E5" />
<view class="flex justify-end mt-base">

View File

@ -1,27 +0,0 @@
<template>
<view class="bg w-250rpx h-350rpx inline-block mx-14rpx relative">
<view class="absolute top-120rpx left-0 w-full">
<view class="items-end text-hex-fe211a text-center">
<text class="text-40rpx"></text>
<text class="text-80rpx">30</text>
</view>
<view class="text-hex-da8844 text-18rpx text-center mt-20rpx">20元积分+1元兑换</view>
<view class="mx-auto w-180rpx mt-30rpx h-48rpx" @click="onClick"></view>
</view>
</view>
</template>
<script>
export default {
methods:{
onClick(){
this.$emit('click')
}
}
}
</script>
<style lang="scss" scoped>
.bg {
// background: url('/static/images/coupon/coupon-bg.png') no-repeat;
background-size: 100% 100%;
}
</style>

View File

@ -1,44 +0,0 @@
<template>
<view class="inline-block shadow shadow-gray-100 rounded-20rpx" @tap.stop="$u.route('/pages/product_details/index', { skuId: data.id })">
<view class="rounded-t-20rpx h-318rpx w-318rpx overflow-hidden">
<u-image :src="data.cover" :lazy-load="true" width="100%" height="100%"></u-image>
</view>
<view class="flex items-center p-20rpx">
<view class="flex-1 text-left w-0">
<view class="line-1">{{data.name}}</view>
<view>{{price}}</view>
</view>
<view>
<view class="border border-solid border-hex-e0a272 rounded-8rpx h-58rpx leading-58rpx px-20rpx text-hex-e0a272" @click.prevent.stop="onClick">兑换</view>
</view>
</view>
</view>
</template>
<script>
export default {
props:['data'],
computed:{
price(){
let price = ''
if(this.data.sell_price > 0) price+=`${parseFloat(this.data.sell_price)}`
if(this.data.sell_price > 0 && this.data.redeem_points > 0) price+='+'
if(this.data.redeem_points > 0) price+=`${this.data.redeem_points} 积分`
return price
}
},
methods:{
onClick(){
const params = {
goods: [
{
sku_id: this.data.id,
num: 1,
},
],
type: 'points'
};
this.$u.routeAuth('/pages/confirm_order/confirm_order?data=' + encodeURIComponent(JSON.stringify(params)));
}
}
}
</script>

View File

@ -19,7 +19,6 @@
<scroll-view scroll-y class="h-full">
<view class="h-20rpx"></view>
<mescroll-body
:height="height"
ref="mescrollRef"
@init="mescrollInit"
@ -30,8 +29,9 @@
>
<view class="bg-white p-20rpx mb-10rpx" v-for="item in dataList" :key="item">
<view class="flex justify-between text-32rpx">
<view>{{item.desc}}</view>
<view class="text-hex-cb9e7a">{{item.points}}积分</view>
<view>{{item.remark}}</view>
<view v-if="item.change_points > 0" class="text-success">+{{item.change_points}}</view>
<view v-else class="text-error">{{item.change_points}}积分</view>
</view>
<view class="mt-20rpx text-28rpx text-hex-a3a3a3">{{item.created_at}}</view>
</view>
@ -78,7 +78,7 @@ export default {
page: page.num,
per_page: page.size,
};
await this.$api.get('/v1/points/points-logs', {
await this.$api.get('/v1/point-logs', {
params: obj,
}).then((res) => {
this.mescroll.endSuccess(res.data.length);

View File

@ -1,11 +0,0 @@
<template>
<view class="pt-20rpx">
<view class="bg-white p-20rpx mb-10rpx" v-for="item in 10" :key="item">
<view class="flex justify-between text-32rpx">
<view>兑换物品名称</view>
<view class="text-hex-cb9e7a">150+10积分</view>
</view>
<view class="mt-20rpx text-28rpx text-hex-a3a3a3">2022-03-19</view>
</view>
</view>
</template>

View File

@ -1,180 +0,0 @@
<template>
<view class="min-h-full flex flex-col">
<view class="h-358rpx bg-gradient-to-t to-hex-fff4e5 from-hex-ffd4b2">
<view class="text-center text-48rpx pt-80rpx font-medium">积分兑换</view>
<view class="text-center mt-50rpx text-28rpx">我的积分{{points}} 积分</view>
<view class="flex justify-around mt-70rpx">
<!-- <view class="bg-white rounded-full text-hex-fe9b35 h-48rpx leading-48rpx px-46rpx">我的兑换</view> -->
<view class="bg-white rounded-full text-hex-fe9b35 h-48rpx leading-48rpx px-46rpx" @click="$u.route('/pages/points/record')"></view>
</view>
</view>
<!-- <view class="mt-10rpx bg-white py-20rpx">
<view class="flex">
<view class="h-30rpx w-22rpx bg-hex-e0a272"></view>
<view class="text-32rpx ml-14rpx">优惠券</view>
</view>
<scroll-view scroll-x class="w-full whitespace-nowrap mt-20rpx">
<CouponComp v-for="item in 4" :key="item" @click="onLq"></CouponComp>
</scroll-view>
</view> -->
<view class="mt-10rpx bg-white py-20rpx flex-1">
<view class="flex">
<view class="h-30rpx w-22rpx bg-hex-e0a272"></view>
<view class="text-32rpx ml-14rpx">兑好礼</view>
</view>
<view class="mt-20rpx">
<u-tabs :list="list" is-scroll :current="current" @change="change" active-color="#e0a272" height="60" bar-height="8"></u-tabs>
</view>
<view class="px-20rpx">
<mescroll-body
:height="height"
:bottombar="false"
ref="mescrollRef"
@init="mescrollInit"
@down="downCallback"
@up="upCallback"
:up="upOption"
>
<u-waterfall v-model="goodsList" ref="waterfall">
<template v-slot:left="{ leftList }">
<view v-for="(item, index) in leftList" :key="index" class="text-center my-20rpx">
<PointsGoodsComp :data="item"></PointsGoodsComp>
</view>
</template>
<template v-slot:right="{ rightList }">
<view v-for="(item, index) in rightList" :key="index" class="text-center my-20rpx">
<PointsGoodsComp :data="item"></PointsGoodsComp>
</view>
</template>
</u-waterfall>
</mescroll-body>
</view>
</view>
</view>
</template>
<script>
import CouponComp from './components/coupon-comp.vue';
import PointsGoodsComp from './components/points-goods-comp.vue';
import { mapGetters } from 'vuex'
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
export default {
mixins:[MescrollMixin],
components: {
CouponComp,
PointsGoodsComp,
},
data() {
return {
firstLoading: true,
upOption: {
auto: false,
},
list: [],
current: 0,
goodsList:[]
};
},
watch:{
goods:{
immediate:true,
deep:true,
handler(e){
this.goodsList = e.map(el=>el)
}
}
},
computed:{
...mapGetters(['user']),
points(){
return this.user?.points ?? 0
},
goods() {
return this.list[this.current]?.goods ?? [];
},
height() {
const { windowHeight, statusBarHeight } = this.$u.sys();
return windowHeight - statusBarHeight - 296 + 'px';
},
},
created(){
this.$store.dispatch('user/getUserInfo')
},
methods: {
async downCallback() {
this.$refs.waterfall.clear();
this.mescroll.resetUpScroll();
},
async upCallback(page) {
if (this.firstLoading) {
await this.getCategories();
}
this.getGoodsList(page);
// this.firstLoading = false;
},
async getCategories(){
const resData = await this.$api.get('/v1/points/categories')
resData.unshift({
icon: "",
id: -999,
name: "全部"
})
this.list = resData.map((e) => {
return {
...e,
num: 1,
y: 0,
curPageLen: 0,
hasNext: true,
goods: null,
};
});
},
async getGoodsList({ num, size }){
let keyword = this.list[this.current].id;
const resData = await this.$api.get('/v1/points/products', {
params: {
per_page: size,
page: num,
category: keyword == -999?'':keyword,
},
});
const { data } = resData;
let curTab = this.list[this.current];
if (num === 1) curTab.goods = [];
curTab.goods = curTab.goods.concat(data);
curTab.num = num;
curTab.curPageLen = data.length;
curTab.hasNext = this.mescroll.optUp.hasNext;
this.mescroll.endSuccess(data.length, size == data.length);
},
change(index) {
if (!this.current) this.current = 0;
this.$refs.waterfall.clear();
this.$nextTick(() => {
let preTab = this.list[this.current];
preTab.y = this.mescroll.getScrollTop();
this.current = index;
const curTab = this.list[index];
if (!curTab.goods) {
this.mescroll.resetUpScroll();
} else {
this.mescroll.setPageNum(curTab.num + 1);
this.mescroll.endSuccess(curTab.curPageLen, curTab.hasNext);
this.$nextTick(() => {
this.mescroll.scrollTo(curTab.y, 0);
});
}
})
},
onLq() {
console.log('====');
},
},
};
</script>
<style>
page{
height: 100%;
}
</style>