Files
cashier_app/pageMarket/superVip/vip-plans.vue

141 lines
3.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="min-page bg-f7 u-font-28">
<view class="default-box-padding">
<view
v-for="(item, index) in superVipStore.config.configList"
class="u-m-b-56 default-box-radius bg-fff default-box-padding"
>
<view class="u-flex u-row-between">
<text class="u-font-32 font-bold color-000">{{ item.name }}</text>
</view>
<view class="u-m-t-22 color-666 u-font-32 u-flex">
<view class="u-flex-1">
<view>
<text class="color-666">价格</text>
<text>{{item.price}}</text>
</view>
<view class="u-m-t-20">
<text class="color-666">周期</text>
<text> {{item.circleTime}}{{ item.circleUnit }}</text>
</view>
</view>
<view class="u-flex-1">
<view>
<text class="color-666">赠送成长值</text>
<text>{{item.reward}}</text>
</view>
<view class="u-m-t-20">
<text class="color-666">赠送优惠券</text>
<text> {{returnCouponAllNum(item)}}</text>
</view>
</view>
</view>
<view class="u-flex u-row-right gap-20 u-m-t-32">
<view class="btn del" @click="handleDelete(index)">删除</view>
<view class="btn edit" @click="handleEdit(item,index)">编辑</view>
</view>
</view>
</view>
<view style="height: 100rpx"></view>
<view class="fixed-bottom">
<my-button @click="go.to('PAGES_MARKET_SUPER_VIP_ADD_PLAN')">
<view class="u-flex">
<up-icon name="plus" color="#fff" size="12"></up-icon>
<text class="u-m-l-10">添加方案</text>
</view>
</my-button>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom,
onBackPress,
} from "@dcloudio/uni-app";
import { useSuperVipStore } from "@/store/market.js";
import go from "@/commons/utils/go.js";
const superVipStore = useSuperVipStore();
import { ref, reactive, onMounted } from "vue";
function handleDelete(index) {
uni.showModal({
title: "确认删除吗?",
success: (res) => {
if (res.confirm) {
superVipStore.config.configList.splice(index, 1);
superVipStore.editConfig().then(res=>{
if(res){
uni.showToast({
title: "删除成功",
icon: "none",
});
}
})
}
},
});
}
function returnCouponAllNum(item){
return (item.couponList||[]).reduce((pre,cur)=>pre+cur.num,0)
}
function handleEdit(item,index) {
uni.setStorageSync("suggestItem", item);
go.to("PAGES_MARKET_SUPER_VIP_ADD_PLAN", {
type: "edit",
index: index,
});
}
</script>
<style lang="scss" scoped>
.status {
padding: 8rpx 18rpx;
border: 2rpx solid transparent;
border-radius: 8rpx;
&.status1 {
background-color: rgba(123, 209, 54, 0.12);
border-color: rgba(123, 209, 54, 1);
color: #7bd136;
}
&.status0 {
border-color: rgba(153, 153, 153, 1);
background-color: rgba(153, 153, 153, 0.12);
color: #999;
}
}
.btn {
padding: 8rpx 42rpx;
border-radius: 100rpx;
&.del {
background-color: #f7f7fa;
color: #999;
}
&.edit {
background-color: $my-main-color;
color: #fff;
}
}
.fixed-bottom {
left: 70rpx;
right: 70rpx;
}
.time {
margin-left: 30rpx;
padding: 4rpx 20rpx;
border: 1px solid $my-main-color;
border-radius: 8rpx;
color: $my-main-color;
}
</style>