优化分店营销中心的权限问题
This commit is contained in:
@@ -1,333 +1,293 @@
|
||||
<template>
|
||||
<view class="box">
|
||||
<view class="bg-fff container u-flex u-m-b-32 top">
|
||||
<image
|
||||
style="width: 60rpx; height: 60rpx"
|
||||
src="/pageMarket/static/images/cost.png"
|
||||
></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||
<view class="color-333 font-bold">消费返现</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24"
|
||||
>用户下单后返现一定的金额到余额,可促进复购 </view
|
||||
>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="form.isEnable"
|
||||
:disabled="isMainShop()?false:true"
|
||||
size="18"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 container">
|
||||
<view class="u-flex u-row-between u-m-b-16">
|
||||
<text class="font-bold color-333">可用门店</text>
|
||||
</view>
|
||||
<my-shop-select
|
||||
v-model:selShops="form.shopIdList"
|
||||
v-model:useType="form.useType"
|
||||
></my-shop-select>
|
||||
</view>
|
||||
<view class="box">
|
||||
<view class="bg-fff container u-flex u-m-b-32 top">
|
||||
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/cost.png"></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||
<view class="color-333 font-bold">消费返现</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24">用户下单后返现一定的金额到余额,可促进复购</view>
|
||||
</view>
|
||||
<up-switch v-model="form.isEnable" :disabled="isMainShop() ? false : true" size="18" :active-value="1" :inactive-value="0"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 container">
|
||||
<view class="u-flex u-row-between u-m-b-16">
|
||||
<text class="font-bold color-333">可用门店</text>
|
||||
</view>
|
||||
<my-shop-select v-model:selShops="form.shopIdList" v-model:useType="form.useType"></my-shop-select>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-32 container">
|
||||
<view class="u-flex u-row-between">
|
||||
<text class="font-bold color-333 u-m-b-16">适用用户</text>
|
||||
</view>
|
||||
<userTypes v-model="form.applicableUser"></userTypes>
|
||||
</view>
|
||||
<view class="u-m-t-32 container">
|
||||
<view class="u-flex u-row-between">
|
||||
<text class="font-bold color-333 u-m-b-16">适用用户</text>
|
||||
</view>
|
||||
<userTypes v-model="form.applicableUser"></userTypes>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-32 container">
|
||||
<view class="u-flex u-row-between">
|
||||
<text class="font-bold color-333">返现类型</text>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-radio-group v-model="form.cashbackType" placement="row">
|
||||
<up-radio
|
||||
v-for="item in cashbackTypes"
|
||||
:key="item.value"
|
||||
:name="item.value"
|
||||
:label="item.label"
|
||||
>
|
||||
<template #label>
|
||||
<text>
|
||||
{{ item.label }}
|
||||
</text>
|
||||
</template>
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<text class="font-bold color-333">阶梯设置</text>
|
||||
</view>
|
||||
<view
|
||||
class="u-m-t-32 u-flex u-row-between gap-40"
|
||||
v-for="(item, index) in form.cashbackStepList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="u-flex u-col-top">
|
||||
<view class="no-wrap u-m-r-16 u-m-t-14">{{ returnName(index) }}</view>
|
||||
<view class="u-flex-1">
|
||||
<view class="u-flex">
|
||||
<text class="u-m-r-24"> 返现门槛</text>
|
||||
<input
|
||||
class="my-input"
|
||||
type="digit"
|
||||
v-model="item.amount"
|
||||
placeholder=""
|
||||
/>
|
||||
<text class="text-tips text-tips1">元</text>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24">
|
||||
<text class="u-m-r-24"> {{form.cashbackType === 'percentage' ? '返现比例' : '返现金额'}}</text>
|
||||
<input
|
||||
class="my-input"
|
||||
type="number"
|
||||
v-model="item.cashbackAmount"
|
||||
@blur="inputBlur($event, index)"
|
||||
:max="form.cashbackType === 'percentage' ? 100 : 999999"
|
||||
placeholder=""
|
||||
/>
|
||||
<text class="text-tips text-tips1">{{ returnUnit }} </text>
|
||||
<text class="color-red u-m-l-10" @click="deleteThreshold(index)"
|
||||
>删除</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 container">
|
||||
<view class="u-flex u-row-between">
|
||||
<text class="font-bold color-333">返现类型</text>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-radio-group v-model="form.cashbackType" placement="row">
|
||||
<up-radio v-for="item in cashbackTypes" :key="item.value" :name="item.value" :label="item.label">
|
||||
<template #label>
|
||||
<text>
|
||||
{{ item.label }}
|
||||
</text>
|
||||
</template>
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<text class="font-bold color-333">阶梯设置</text>
|
||||
</view>
|
||||
<view class="u-m-t-32 u-flex u-row-between gap-40" v-for="(item, index) in form.cashbackStepList" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view class="no-wrap u-m-r-16 u-m-t-14">{{ returnName(index) }}</view>
|
||||
<view class="u-flex-1">
|
||||
<view class="u-flex">
|
||||
<text class="u-m-r-24">返现门槛</text>
|
||||
<input class="my-input" type="digit" v-model="item.amount" placeholder="" />
|
||||
<text class="text-tips text-tips1">元</text>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24">
|
||||
<text class="u-m-r-24">{{ form.cashbackType === 'percentage' ? '返现比例' : '返现金额' }}</text>
|
||||
<input
|
||||
class="my-input"
|
||||
type="number"
|
||||
v-model="item.cashbackAmount"
|
||||
@blur="inputBlur($event, index)"
|
||||
:max="form.cashbackType === 'percentage' ? 100 : 999999"
|
||||
placeholder=""
|
||||
/>
|
||||
<text class="text-tips text-tips1">{{ returnUnit }}</text>
|
||||
<text class="color-red u-m-l-10" @click="deleteThreshold(index)">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="add u-m-t-32" @click="addcashbackStepList">添加</button>
|
||||
</view>
|
||||
<my-bottom-btn-group @save="save" isOpenPermission @cancel="cancel"></my-bottom-btn-group>
|
||||
</view>
|
||||
<button class="add u-m-t-32" @click="addcashbackStepList">添加</button>
|
||||
</view>
|
||||
<my-bottom-btn-group @save="save" isOpenPermission @cancel="cancel"></my-bottom-btn-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed, onMounted } from "vue";
|
||||
import userTypes from "./user-types.vue";
|
||||
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||
import { isMainShop } from "@/store/account";
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress,
|
||||
} from "@dcloudio/uni-app";
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed, onMounted } from 'vue';
|
||||
import userTypes from './user-types.vue';
|
||||
import * as consumeCashbackApi from '@/http/api/market/consumeCashback.js';
|
||||
import { isMainShop } from '@/store/account';
|
||||
import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
|
||||
|
||||
//返现类型
|
||||
const cashbackTypes = [
|
||||
{
|
||||
value: "percentage",
|
||||
label: "按比例返现",
|
||||
},
|
||||
{
|
||||
value: "fix",
|
||||
label: "固定金额",
|
||||
},
|
||||
{
|
||||
value: 'percentage',
|
||||
label: '按比例返现'
|
||||
},
|
||||
{
|
||||
value: 'fix',
|
||||
label: '固定金额'
|
||||
}
|
||||
];
|
||||
const form = reactive({
|
||||
isEnable: 0,
|
||||
cashbackStepList: [],
|
||||
shopIdList: [],
|
||||
useType: "all",
|
||||
applicableUser: "all",
|
||||
cashbackType: "percentage",
|
||||
isEnable: 0,
|
||||
cashbackStepList: [],
|
||||
shopIdList: [],
|
||||
useType: 'all',
|
||||
applicableUser: 'all',
|
||||
cashbackType: 'percentage'
|
||||
});
|
||||
function addcashbackStepList() {
|
||||
form.cashbackStepList.push({
|
||||
amount: 0,
|
||||
cashbackAmount: 0,
|
||||
});
|
||||
form.cashbackStepList.push({
|
||||
amount: 0,
|
||||
cashbackAmount: 0
|
||||
});
|
||||
}
|
||||
|
||||
function inputBlur(e, index) {
|
||||
const value = e.detail.value;
|
||||
if (form.cashbackType === "percentage") {
|
||||
if (e.detail.value >= 100) {
|
||||
form.cashbackStepList[index].cashbackAmount = 100;
|
||||
} else if (e.detail.value < 0) {
|
||||
form.cashbackStepList[index].cashbackAmount = 0;
|
||||
} else {
|
||||
form.cashbackStepList[index].cashbackAmount =e.detail.value;
|
||||
}
|
||||
} else {
|
||||
if (e.detail.value < 0) {
|
||||
form.cashbackStepList[index].cashbackAmount = 0;
|
||||
} else if(e.detail.value > form.cashbackStepList[index].amount) {
|
||||
form.cashbackStepList[index].cashbackAmount = form.cashbackStepList[index].amount;
|
||||
} else {
|
||||
form.cashbackStepList[index].cashbackAmount =e.detail.value;
|
||||
}
|
||||
}
|
||||
const value = e.detail.value;
|
||||
if (form.cashbackType === 'percentage') {
|
||||
if (e.detail.value >= 100) {
|
||||
form.cashbackStepList[index].cashbackAmount = 100;
|
||||
} else if (e.detail.value < 0) {
|
||||
form.cashbackStepList[index].cashbackAmount = 0;
|
||||
} else {
|
||||
form.cashbackStepList[index].cashbackAmount = e.detail.value;
|
||||
}
|
||||
} else {
|
||||
if (e.detail.value < 0) {
|
||||
form.cashbackStepList[index].cashbackAmount = 0;
|
||||
} else if (e.detail.value > form.cashbackStepList[index].amount) {
|
||||
form.cashbackStepList[index].cashbackAmount = form.cashbackStepList[index].amount;
|
||||
} else {
|
||||
form.cashbackStepList[index].cashbackAmount = e.detail.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function save() {
|
||||
console.log(form);
|
||||
const submitData = {
|
||||
...form,
|
||||
};
|
||||
const res = await consumeCashbackApi.update(submitData);
|
||||
uni.showToast({
|
||||
title: "更新成功",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
success: function () {},
|
||||
});
|
||||
console.log(form);
|
||||
const submitData = {
|
||||
...form
|
||||
};
|
||||
const res = await consumeCashbackApi.update(submitData);
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
success: function () {}
|
||||
});
|
||||
}
|
||||
function cancel() {
|
||||
uni.navigateBack();
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
function deleteThreshold(index) {
|
||||
form.cashbackStepList.splice(index, 1);
|
||||
form.cashbackStepList.splice(index, 1);
|
||||
}
|
||||
function setForm(data) {
|
||||
data.cashbackStepList=data.cashbackStepList||[]
|
||||
Object.assign(form, data);
|
||||
console.log(form);
|
||||
data.cashbackStepList = data.cashbackStepList || [];
|
||||
Object.assign(form, data);
|
||||
console.log(form);
|
||||
}
|
||||
const returnUnit = computed(() => {
|
||||
return form.cashbackType === "percentage" ? "%" : "元";
|
||||
return form.cashbackType === 'percentage' ? '%' : '元';
|
||||
});
|
||||
|
||||
const numChineseMap = {
|
||||
0: "零",
|
||||
1: "一",
|
||||
2: "二",
|
||||
3: "三",
|
||||
4: "四",
|
||||
5: "五",
|
||||
6: "六",
|
||||
7: "七",
|
||||
8: "八",
|
||||
9: "九",
|
||||
10: "十",
|
||||
100: "百",
|
||||
1000: "千",
|
||||
0: '零',
|
||||
1: '一',
|
||||
2: '二',
|
||||
3: '三',
|
||||
4: '四',
|
||||
5: '五',
|
||||
6: '六',
|
||||
7: '七',
|
||||
8: '八',
|
||||
9: '九',
|
||||
10: '十',
|
||||
100: '百',
|
||||
1000: '千'
|
||||
};
|
||||
|
||||
// 辅助函数:将数字转换为中文数字
|
||||
function numberToChinese(n) {
|
||||
if (n < 10) {
|
||||
return numChineseMap[n];
|
||||
}
|
||||
if (n < 10) {
|
||||
return numChineseMap[n];
|
||||
}
|
||||
|
||||
// 处理10-99
|
||||
if (n < 100) {
|
||||
const ten = Math.floor(n / 10);
|
||||
const unit = n % 10;
|
||||
if (ten === 1) {
|
||||
return unit === 0 ? "十" : `十${numChineseMap[unit]}`;
|
||||
} else {
|
||||
return unit === 0
|
||||
? `${numChineseMap[ten]}十`
|
||||
: `${numChineseMap[ten]}十${numChineseMap[unit]}`;
|
||||
}
|
||||
}
|
||||
// 处理10-99
|
||||
if (n < 100) {
|
||||
const ten = Math.floor(n / 10);
|
||||
const unit = n % 10;
|
||||
if (ten === 1) {
|
||||
return unit === 0 ? '十' : `十${numChineseMap[unit]}`;
|
||||
} else {
|
||||
return unit === 0 ? `${numChineseMap[ten]}十` : `${numChineseMap[ten]}十${numChineseMap[unit]}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理100-999
|
||||
if (n < 1000) {
|
||||
const hundred = Math.floor(n / 100);
|
||||
const remainder = n % 100;
|
||||
if (remainder === 0) {
|
||||
return `${numChineseMap[hundred]}百`;
|
||||
} else {
|
||||
return `${numChineseMap[hundred]}百${
|
||||
remainder < 10 ? "零" : ""
|
||||
}${numberToChinese(remainder)}`;
|
||||
}
|
||||
}
|
||||
// 处理100-999
|
||||
if (n < 1000) {
|
||||
const hundred = Math.floor(n / 100);
|
||||
const remainder = n % 100;
|
||||
if (remainder === 0) {
|
||||
return `${numChineseMap[hundred]}百`;
|
||||
} else {
|
||||
return `${numChineseMap[hundred]}百${remainder < 10 ? '零' : ''}${numberToChinese(remainder)}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理1000-9999
|
||||
if (n < 10000) {
|
||||
const thousand = Math.floor(n / 1000);
|
||||
const remainder = n % 1000;
|
||||
if (remainder === 0) {
|
||||
return `${numChineseMap[thousand]}千`;
|
||||
} else {
|
||||
return `${numChineseMap[thousand]}千${
|
||||
remainder < 100 ? "零" : ""
|
||||
}${numberToChinese(remainder)}`;
|
||||
}
|
||||
}
|
||||
// 处理1000-9999
|
||||
if (n < 10000) {
|
||||
const thousand = Math.floor(n / 1000);
|
||||
const remainder = n % 1000;
|
||||
if (remainder === 0) {
|
||||
return `${numChineseMap[thousand]}千`;
|
||||
} else {
|
||||
return `${numChineseMap[thousand]}千${remainder < 100 ? '零' : ''}${numberToChinese(remainder)}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 更大的数字可以继续扩展(如万、亿等),这里以千为单位示例
|
||||
return n.toString(); // 超过范围时返回数字本身(可根据需求扩展)
|
||||
// 更大的数字可以继续扩展(如万、亿等),这里以千为单位示例
|
||||
return n.toString(); // 超过范围时返回数字本身(可根据需求扩展)
|
||||
}
|
||||
|
||||
// 主函数:根据索引返回对应的组名
|
||||
function returnName(index) {
|
||||
const groupNumber = index + 1; // 索引从0开始,组号从1开始
|
||||
const chineseNumber = numberToChinese(groupNumber);
|
||||
return `第${chineseNumber}组`;
|
||||
const groupNumber = index + 1; // 索引从0开始,组号从1开始
|
||||
const chineseNumber = numberToChinese(groupNumber);
|
||||
return `第${chineseNumber}组`;
|
||||
}
|
||||
|
||||
const emits = defineEmits(['get']);
|
||||
async function getData() {
|
||||
const res = await consumeCashbackApi.getConfig();
|
||||
if (res) {
|
||||
setForm(res);
|
||||
}
|
||||
const res = await consumeCashbackApi.getConfig();
|
||||
emits('get', res);
|
||||
if (res) {
|
||||
setForm(res);
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
getData();
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: #f7f7f7;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
.x-padding {
|
||||
padding: 0 24rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
.text-tips {
|
||||
color: #999999;
|
||||
font-size: 14px;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 6rpx 0 0 6rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
background-color: #f7f7fa;
|
||||
line-height: 60rpx;
|
||||
color: #999999;
|
||||
font-size: 14px;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 6rpx 0 0 6rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
background-color: #f7f7fa;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
.text-tips1 {
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
}
|
||||
.gap-40 {
|
||||
gap: 40rpx;
|
||||
gap: 40rpx;
|
||||
}
|
||||
.my-input {
|
||||
border: 2rpx solid #d9d9d9;
|
||||
height: 60rpx;
|
||||
border-right: none;
|
||||
width: 240rpx;
|
||||
text-align: center;
|
||||
padding: 0 2px;
|
||||
font-size: 14px;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
height: 60rpx;
|
||||
border-right: none;
|
||||
width: 240rpx;
|
||||
text-align: center;
|
||||
padding: 0 2px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.box {
|
||||
padding: 0 28rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 0 28rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.container {
|
||||
background: #fff;
|
||||
padding: 32rpx 24rpx;
|
||||
margin-top: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
padding: 32rpx 24rpx;
|
||||
margin-top: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.add {
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
background: #318afe;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
line-height: 56rpx;
|
||||
margin: 0;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
background: #318afe;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
line-height: 56rpx;
|
||||
margin: 0;
|
||||
}
|
||||
.color-red {
|
||||
color: #ff2f2f;
|
||||
color: #ff2f2f;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -5,29 +5,27 @@
|
||||
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
|
||||
<view class="u-flex u-m-t-40" v-if="active == 1">
|
||||
<view class="u-flex color-333" @click="showShopSelActionSheetFun">
|
||||
<text class="u-line-1" style="max-width: 300rpx;">{{selShop.shopName || "全部门店"}}</text>
|
||||
<text class="u-line-1" style="max-width: 300rpx">{{ selShop.shopName || '全部门店' }}</text>
|
||||
<up-icon name="arrow-down-fill" size="12" color="#333"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号"
|
||||
|
||||
@search="search" @clear="search" v-model="searchText"></up-search>
|
||||
<up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号" @search="search" @clear="search" v-model="searchText"></up-search>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<configVue v-if="active == 0"></configVue>
|
||||
<configVue v-if="active == 0" @get="getConfigData"></configVue>
|
||||
<view class="list u-font-28" v-if="active == 1">
|
||||
<view class="u-m-t-32 item" v-for="item in list" :key="item.id">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="color-999 u-font-24">
|
||||
<view> 关联订单:{{ item.orderNo }} </view>
|
||||
<view>关联订单:{{ item.orderNo }}</view>
|
||||
<view class="u-m-t-14">
|
||||
<text class="color-333 font-bold u-m-r-20"> {{ item.shopName }}</text>
|
||||
<text class="color-333 font-bold u-m-r-20">{{ item.shopName }}</text>
|
||||
<text class="color-666 u-font-24">{{ item.createTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="color-999 u-font-24"> ID:{{ item.id }} </text>
|
||||
<text class="color-999 u-font-24">ID:{{ item.id }}</text>
|
||||
</view>
|
||||
<view class="u-m-t-22">
|
||||
<u-line></u-line>
|
||||
@@ -40,16 +38,15 @@
|
||||
<view class="u-flex u-text-center">
|
||||
<view>
|
||||
<view class="color-666">返现金额</view>
|
||||
<view class="color-333 u-m-t-24">{{ item.cashbackAmount ||0 }}</view>
|
||||
<view class="color-333 u-m-t-24">{{ item.cashbackAmount || 0 }}</view>
|
||||
</view>
|
||||
<view style="margin-left: 54rpx;">
|
||||
<view style="margin-left: 54rpx">
|
||||
<view class="color-666">支付金额</view>
|
||||
<view class="color-333 u-m-t-24">{{ item.amount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 32rpx;"></view>
|
||||
|
||||
<view style="height: 32rpx"></view>
|
||||
</view>
|
||||
<view class="u-p-30">
|
||||
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
|
||||
@@ -57,159 +54,157 @@
|
||||
</view>
|
||||
|
||||
<!-- 选择门店 -->
|
||||
<shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店">
|
||||
</shopSelActionSheetVue>
|
||||
<shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店"></shopSelActionSheetVue>
|
||||
|
||||
<my-marketing-mask name="消费返现" v-if="isMarketShow(configInfo)"></my-marketing-mask>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { isMainShop } from "@/store/account.js";
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
watch
|
||||
} from "vue";
|
||||
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||
import configVue from './components/config.vue'
|
||||
import shopSelActionSheetVue from '@/pageMarket/components/shop-sel-action-sheet.vue'
|
||||
const tabs = [{
|
||||
label: "基本设置",
|
||||
value: "basic"
|
||||
},
|
||||
{
|
||||
label: "返现明细",
|
||||
value: "recoders"
|
||||
},
|
||||
];
|
||||
import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
|
||||
import { isMainShop, isMarketShow } from '@/store/account.js';
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import * as consumeCashbackApi from '@/http/api/market/consumeCashback.js';
|
||||
import configVue from './components/config.vue';
|
||||
import shopSelActionSheetVue from '@/pageMarket/components/shop-sel-action-sheet.vue';
|
||||
const tabs = [
|
||||
{
|
||||
label: '基本设置',
|
||||
value: 'basic'
|
||||
},
|
||||
{
|
||||
label: '返现明细',
|
||||
value: 'recoders'
|
||||
}
|
||||
];
|
||||
const configInfo = ref({});
|
||||
function getConfigData(e) {
|
||||
configInfo.value = e;
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
const pageNum = ref(1);
|
||||
const isEnd = ref(false);
|
||||
const selShop = ref({
|
||||
shopId: "",
|
||||
shopName: "",
|
||||
})
|
||||
const searchText = ref("");
|
||||
const list = ref([]);
|
||||
const pageNum = ref(1);
|
||||
const isEnd = ref(false);
|
||||
const selShop = ref({
|
||||
shopId: '',
|
||||
shopName: ''
|
||||
});
|
||||
const searchText = ref('');
|
||||
|
||||
function search() {
|
||||
function search() {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
function chooseShop(e) {
|
||||
selShop.value = e;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => selShop.value.shopId,
|
||||
(newval) => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
function chooseShop(e) {
|
||||
selShop.value = e;
|
||||
}
|
||||
|
||||
watch(()=>selShop.value.shopId,(newval)=>{
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
})
|
||||
|
||||
async function getList() {
|
||||
const res = await consumeCashbackApi.getList({
|
||||
pageNum: pageNum.value,
|
||||
pageSize: 10,
|
||||
shopId: selShop.value.shopId,
|
||||
key: searchText.value,
|
||||
});
|
||||
if (res) {
|
||||
if (pageNum.value == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = [...list.value, ...(res.records || [])];
|
||||
}
|
||||
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
|
||||
console.log(isEnd.value);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示选择门店弹窗
|
||||
const showShopSelActionSheet = ref(false);
|
||||
|
||||
function showShopSelActionSheetFun() {
|
||||
showShopSelActionSheet.value = true;
|
||||
}
|
||||
const active = ref(0);
|
||||
watch(
|
||||
() => active.value,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
|
||||
}
|
||||
);
|
||||
onReachBottom(() => {
|
||||
if (!isEnd.value) {
|
||||
pageNum.value++;
|
||||
getList();
|
||||
}
|
||||
async function getList() {
|
||||
const res = await consumeCashbackApi.getList({
|
||||
pageNum: pageNum.value,
|
||||
pageSize: 10,
|
||||
shopId: selShop.value.shopId,
|
||||
key: searchText.value
|
||||
});
|
||||
onShow(() => {
|
||||
if (res) {
|
||||
if (pageNum.value == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = [...list.value, ...(res.records || [])];
|
||||
}
|
||||
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
|
||||
console.log(isEnd.value);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示选择门店弹窗
|
||||
const showShopSelActionSheet = ref(false);
|
||||
|
||||
function showShopSelActionSheetFun() {
|
||||
showShopSelActionSheet.value = true;
|
||||
}
|
||||
const active = ref(0);
|
||||
watch(
|
||||
() => active.value,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
);
|
||||
onReachBottom(() => {
|
||||
if (!isEnd.value) {
|
||||
pageNum.value++;
|
||||
getList();
|
||||
}
|
||||
});
|
||||
onShow(() => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.min-page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
.min-page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.box {}
|
||||
.box {
|
||||
}
|
||||
|
||||
.top {
|
||||
.top {
|
||||
padding: 32rpx 24rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 0 30rpx;
|
||||
|
||||
.item {
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 14rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
border-radius: 12rpx;
|
||||
padding: 8rpx 22rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
&.success {
|
||||
background-color: #edfff0;
|
||||
color: #5bbc6d;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 0 30rpx;
|
||||
|
||||
.item {
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 14rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
&.end {
|
||||
background-color: #f7f7f7;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
border-radius: 12rpx;
|
||||
padding: 8rpx 22rpx;
|
||||
font-size: 28rpx;
|
||||
.my-btn {
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #edfff0;
|
||||
color: #5bbc6d;
|
||||
}
|
||||
.edit-btn {
|
||||
background: #e6f0ff;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
&.end {
|
||||
background-color: #f7f7f7;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.my-btn {
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
background: #e6f0ff;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
background: #ffe7e6;
|
||||
color: #ff1c1c;
|
||||
}
|
||||
</style>
|
||||
.delete-btn {
|
||||
background: #ffe7e6;
|
||||
color: #ff1c1c;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,359 +1,325 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28">
|
||||
<up-sticky>
|
||||
<view class="bg-fff default-box-padding">
|
||||
<view class="u-flex">
|
||||
<image
|
||||
style="width: 60rpx; height: 60rpx"
|
||||
src="/pageMarket/static/images/coupon_code.png"
|
||||
></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-24">
|
||||
<view class="color-333 font-bold">券兑换码 </view>
|
||||
<view class="color-666 u-m-t-4 u-font-24"
|
||||
>可添加多券组合兑换
|
||||
</view>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
||||
:disabled="isMainShop()?false:true"
|
||||
<view class="min-page bg-f7 u-font-28">
|
||||
<up-sticky>
|
||||
<view class="bg-fff default-box-padding">
|
||||
<view class="u-flex">
|
||||
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/coupon_code.png"></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-24">
|
||||
<view class="color-333 font-bold">券兑换码</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24">可添加多券组合兑换</view>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
||||
:disabled="isMainShop() ? false : true"
|
||||
size="18"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="u-p-t-60 default-box-x-padding">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="shop" @click="showShopModal">适用门店</view>
|
||||
<view class="u-flex status-sel u-row-between bg-fff u-line-1" @click="showStatusModal">
|
||||
<text class="color-999" v-if="returnStatusText == '全部'">全部</text>
|
||||
<text class="color-333" v-else>{{ returnStatusText }}</text>
|
||||
<up-icon name="arrow-down" size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="default-box-padding">
|
||||
<view v-for="(item, index) in list" 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-333">{{ item.name }}</text>
|
||||
<view class="status" :class="['status' + item.status]">{{ item.status == 0 ? '有效' : '无效' }}</view>
|
||||
</view>
|
||||
<view class="u-m-t-22 color-666 u-font-24 u-flex">
|
||||
<view>
|
||||
<view>有效期:{{ item.startTime }} 至 {{ item.endTime }}</view>
|
||||
<view class="u-m-t-16">
|
||||
优惠券(张):
|
||||
<text class="color-333 u-font-28 font-bold">{{ item.couponNum }}</text>
|
||||
</view>
|
||||
<view class="u-m-t-16">{{ returnCoupon(item) }}</view>
|
||||
</view>
|
||||
|
||||
size="18"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="u-p-t-60 default-box-x-padding">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="shop" @click="showShopModal">适用门店</view>
|
||||
<view
|
||||
class="u-flex status-sel u-row-between bg-fff u-line-1"
|
||||
@click="showStatusModal"
|
||||
>
|
||||
<text class="color-999" v-if="returnStatusText == '全部'">全部</text>
|
||||
<text class="color-333" v-else>{{ returnStatusText }}</text>
|
||||
<up-icon name="arrow-down" size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="default-box-padding">
|
||||
<view
|
||||
v-for="(item, index) in list"
|
||||
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-333">{{ item.name }}</text>
|
||||
<view class="status" :class="['status' + item.status]">{{
|
||||
item.status == 0 ? "有效" : "无效"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-22 color-666 u-font-24 u-flex">
|
||||
<view>
|
||||
<view> 有效期:{{ item.startTime }} 至 {{ item.endTime }}</view>
|
||||
<view class="u-m-t-16"
|
||||
>优惠券(张):
|
||||
<text class="color-333 u-font-28 font-bold">{{
|
||||
item.couponNum
|
||||
}}</text></view
|
||||
>
|
||||
<view class="u-m-t-16">{{ returnCoupon(item) }}</view>
|
||||
</view>
|
||||
|
||||
<view class="btn edit" @click="handleEdit(item)">查看</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<view class="btn edit" @click="handleEdit(item)">查看</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<view class="btn del" @click="handleDelete(item)">删除</view>
|
||||
<view class="btn edit" @click="handleEdit(item)">查看</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="isMainShop()">
|
||||
<view style="height: 100rpx"></view>
|
||||
<view class="fixed-bottom">
|
||||
<my-button @click="go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_ADD')"
|
||||
>添加兑换码</my-button
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="isMainShop()">
|
||||
<view style="height: 100rpx"></view>
|
||||
<view class="fixed-bottom">
|
||||
<my-button @click="go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_ADD')">添加兑换码</my-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<Modal
|
||||
v-model="modalData.show"
|
||||
:title="modalData.title"
|
||||
@confirm="handleConfirm"
|
||||
>
|
||||
<template v-if="modalData.key == 'selShop'">
|
||||
<view class="default-box-padding">
|
||||
<my-shop-select
|
||||
@shop-select="shopSelect"
|
||||
v-model:selShops="form.shopIdList"
|
||||
v-model:useType="form.useType"
|
||||
></my-shop-select>
|
||||
</view>
|
||||
</template>
|
||||
</Modal>
|
||||
<Modal v-model="modalData.show" :title="modalData.title" @confirm="handleConfirm">
|
||||
<template v-if="modalData.key == 'selShop'">
|
||||
<view class="default-box-padding">
|
||||
<my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useType"></my-shop-select>
|
||||
</view>
|
||||
</template>
|
||||
</Modal>
|
||||
|
||||
<u-action-sheet
|
||||
:actions="actions"
|
||||
cancelText="取消"
|
||||
:closeOnClickAction="true"
|
||||
round="6"
|
||||
@close="showAction = false"
|
||||
@select="selectStatus"
|
||||
:show="showAction"
|
||||
></u-action-sheet>
|
||||
</view>
|
||||
<u-action-sheet
|
||||
:actions="actions"
|
||||
cancelText="取消"
|
||||
:closeOnClickAction="true"
|
||||
round="6"
|
||||
@close="showAction = false"
|
||||
@select="selectStatus"
|
||||
:show="showAction"
|
||||
></u-action-sheet>
|
||||
<my-marketing-mask name="充值兑换码" v-if="isMarketShow(form)"></my-marketing-mask>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress,
|
||||
} from "@dcloudio/uni-app";
|
||||
import Modal from "@/pageMarket/components/modal.vue";
|
||||
import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
|
||||
import { useAccountInfoStore } from "@/store/account.js";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import { isMainShop } from "@/store/account.js";
|
||||
import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
|
||||
import Modal from '@/pageMarket/components/modal.vue';
|
||||
import * as couponRedemptionApi from '@/http/api/market/couponRedemption.js';
|
||||
import { useAccountInfoStore } from '@/store/account.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { isMainShop, isMarketShow } from '@/store/account.js';
|
||||
const accountInfoStore = useAccountInfoStore();
|
||||
import { ref, reactive, onMounted, computed, watch } from "vue";
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue';
|
||||
const loadFinish = ref(false);
|
||||
const form = reactive({
|
||||
isEnable: 0,
|
||||
useType: "all",
|
||||
shopIdList: [],
|
||||
isEnable: 0,
|
||||
useType: 'all',
|
||||
shopIdList: []
|
||||
});
|
||||
|
||||
const actions = [
|
||||
{
|
||||
name: "全部",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
name: "有效",
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
name: "无效",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
name: '全部',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
name: '有效',
|
||||
value: '0'
|
||||
},
|
||||
{
|
||||
name: '无效',
|
||||
value: '1'
|
||||
}
|
||||
];
|
||||
const returnStatusText = computed(() => {
|
||||
return actions.find((item) => item.value == query.status)?.name || "全部";
|
||||
return actions.find((item) => item.value == query.status)?.name || '全部';
|
||||
});
|
||||
|
||||
function returnCoupon(item) {
|
||||
return item.couponInfoList
|
||||
.reduce((prev, cur) => prev + cur.title + "*" + cur.num + "、", "")
|
||||
.slice(0, -1);
|
||||
return item.couponInfoList.reduce((prev, cur) => prev + cur.title + '*' + cur.num + '、', '').slice(0, -1);
|
||||
}
|
||||
const showAction = ref(false);
|
||||
function selectStatus(item) {
|
||||
console.log(item);
|
||||
query.status = item.value;
|
||||
console.log(item);
|
||||
query.status = item.value;
|
||||
}
|
||||
|
||||
function showStatusModal() {
|
||||
showAction.value = true;
|
||||
showAction.value = true;
|
||||
}
|
||||
|
||||
function showShopModal() {
|
||||
modalData.show = true;
|
||||
modalData.title = "适用门店";
|
||||
modalData.key = "selShop";
|
||||
modalData.show = true;
|
||||
modalData.title = '适用门店';
|
||||
modalData.key = 'selShop';
|
||||
}
|
||||
|
||||
const firstModalTime = ref(0);
|
||||
const modalData = reactive({
|
||||
show: false,
|
||||
title: "",
|
||||
key: "",
|
||||
show: false,
|
||||
title: '',
|
||||
key: ''
|
||||
});
|
||||
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: "确认删除吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
couponRedemptionApi
|
||||
.delete({
|
||||
id: item.id,
|
||||
})
|
||||
.then((res) => {
|
||||
uni.showToast({
|
||||
title: "删除成功",
|
||||
icon: "none",
|
||||
});
|
||||
refreshList();
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
uni.showModal({
|
||||
title: '确认删除吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
couponRedemptionApi
|
||||
.delete({
|
||||
id: item.id
|
||||
})
|
||||
.then((res) => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
});
|
||||
refreshList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const isEnd = ref(false);
|
||||
const query = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: "",
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: ''
|
||||
});
|
||||
const list = ref([]);
|
||||
function refreshList() {
|
||||
query.pageNum = 1;
|
||||
isEnd.value = false;
|
||||
getList();
|
||||
query.pageNum = 1;
|
||||
isEnd.value = false;
|
||||
getList();
|
||||
}
|
||||
|
||||
function handleEdit(item) {
|
||||
uni.setStorageSync("couponRedemptionItem", item);
|
||||
go.to("PAGES_MARKET_COUPON_EXCHANGE_CODE_DETAIL", {
|
||||
type: "edit",
|
||||
});
|
||||
uni.setStorageSync('couponRedemptionItem', item);
|
||||
go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_DETAIL', {
|
||||
type: 'edit'
|
||||
});
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (form.useType == "custom") {
|
||||
if (form.shopIdList.length == 0) {
|
||||
uni.showToast({
|
||||
title: "请选择适用门店",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (form.useType == 'custom') {
|
||||
if (form.shopIdList.length == 0) {
|
||||
uni.showToast({
|
||||
title: '请选择适用门店',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
couponRedemptionApi.enable({
|
||||
shopIdList: form.shopIdList || [],
|
||||
useType: form.useType,
|
||||
isEnable: form.isEnable,
|
||||
});
|
||||
uni.showToast({
|
||||
title: "修改成功",
|
||||
icon: "none",
|
||||
});
|
||||
modalData.show = false;
|
||||
couponRedemptionApi.enable({
|
||||
shopIdList: form.shopIdList || [],
|
||||
useType: form.useType,
|
||||
isEnable: form.isEnable
|
||||
});
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
});
|
||||
modalData.show = false;
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
loadFinish.value = false;
|
||||
if (isEnd.value) {
|
||||
return;
|
||||
}
|
||||
const res = await couponRedemptionApi.couponRedemptionList(query);
|
||||
loadFinish.value = true;
|
||||
if (query.pageNum >= res.totalPage * 1) {
|
||||
isEnd.value = true;
|
||||
}
|
||||
if (query.pageNum == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = list.value.concat(res.records || []);
|
||||
}
|
||||
console.log(list.value);
|
||||
query.pageNum++;
|
||||
loadFinish.value = false;
|
||||
if (isEnd.value) {
|
||||
return;
|
||||
}
|
||||
const res = await couponRedemptionApi.couponRedemptionList(query);
|
||||
loadFinish.value = true;
|
||||
if (query.pageNum >= res.totalPage * 1) {
|
||||
isEnd.value = true;
|
||||
}
|
||||
if (query.pageNum == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = list.value.concat(res.records || []);
|
||||
}
|
||||
console.log(list.value);
|
||||
query.pageNum++;
|
||||
};
|
||||
|
||||
function getShopInfo() {
|
||||
accountInfoStore.getShopInfo().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
accountInfoStore.getShopInfo().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
watch(
|
||||
() => accountInfoStore.shopInfo.isProductSuggest,
|
||||
(newVal, oldVal) => {
|
||||
if(!isMainShop()) return;
|
||||
if (!loadFinish.value) return;
|
||||
accountInfoStore.editShopInfo({
|
||||
isProductSuggest: newVal,
|
||||
id: accountInfoStore.shopInfo.id,
|
||||
});
|
||||
uni.showToast({
|
||||
title: "修改成功",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
() => accountInfoStore.shopInfo.isProductSuggest,
|
||||
(newVal, oldVal) => {
|
||||
if (!isMainShop()) return;
|
||||
if (!loadFinish.value) return;
|
||||
accountInfoStore.editShopInfo({
|
||||
isProductSuggest: newVal,
|
||||
id: accountInfoStore.shopInfo.id
|
||||
});
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => query.status,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
refreshList();
|
||||
}
|
||||
() => query.status,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
refreshList();
|
||||
}
|
||||
);
|
||||
|
||||
async function getConfig() {
|
||||
couponRedemptionApi.status().then((res) => {
|
||||
res.shopIdList = res.shopIdList || [];
|
||||
Object.assign(form, res);
|
||||
});
|
||||
couponRedemptionApi.status().then((res) => {
|
||||
res.shopIdList = res.shopIdList || [];
|
||||
Object.assign(form, res);
|
||||
});
|
||||
}
|
||||
onReachBottom(() => {
|
||||
console.log("触底");
|
||||
getList();
|
||||
console.log('触底');
|
||||
getList();
|
||||
});
|
||||
onMounted(() => {
|
||||
getShopInfo();
|
||||
getConfig();
|
||||
getShopInfo();
|
||||
getConfig();
|
||||
});
|
||||
onShow(() => {
|
||||
refreshList();
|
||||
refreshList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.status {
|
||||
padding: 8rpx 18rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 8rpx;
|
||||
&.status0 {
|
||||
background-color: rgba(123, 209, 54, 0.12);
|
||||
border-color: rgba(123, 209, 54, 1);
|
||||
color: #7bd136;
|
||||
}
|
||||
&.status1 {
|
||||
border-color: rgba(153, 153, 153, 1);
|
||||
background-color: rgba(153, 153, 153, 0.12);
|
||||
color: #999;
|
||||
}
|
||||
padding: 8rpx 18rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 8rpx;
|
||||
&.status0 {
|
||||
background-color: rgba(123, 209, 54, 0.12);
|
||||
border-color: rgba(123, 209, 54, 1);
|
||||
color: #7bd136;
|
||||
}
|
||||
&.status1 {
|
||||
border-color: rgba(153, 153, 153, 1);
|
||||
background-color: rgba(153, 153, 153, 0.12);
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
padding: 8rpx 42rpx;
|
||||
white-space: nowrap;
|
||||
border-radius: 100rpx;
|
||||
&.del {
|
||||
background-color: #f7f7fa;
|
||||
color: #999;
|
||||
}
|
||||
&.edit {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
padding: 8rpx 42rpx;
|
||||
white-space: nowrap;
|
||||
border-radius: 100rpx;
|
||||
&.del {
|
||||
background-color: #f7f7fa;
|
||||
color: #999;
|
||||
}
|
||||
&.edit {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.fixed-bottom {
|
||||
}
|
||||
.time {
|
||||
margin-left: 30rpx;
|
||||
padding: 4rpx 20rpx;
|
||||
border: 1px solid $my-main-color;
|
||||
border-radius: 8rpx;
|
||||
color: $my-main-color;
|
||||
margin-left: 30rpx;
|
||||
padding: 4rpx 20rpx;
|
||||
border: 1px solid $my-main-color;
|
||||
border-radius: 8rpx;
|
||||
color: $my-main-color;
|
||||
}
|
||||
.shop {
|
||||
background-color: rgba(49, 138, 254, 0.07);
|
||||
color: $my-main-color;
|
||||
border: 1px solid $my-main-color;
|
||||
padding: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: rgba(49, 138, 254, 0.07);
|
||||
color: $my-main-color;
|
||||
border: 1px solid $my-main-color;
|
||||
padding: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.status-sel {
|
||||
min-width: 266rpx;
|
||||
padding: 18rpx 32rpx;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
min-width: 266rpx;
|
||||
padding: 18rpx 32rpx;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,372 +1,335 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28">
|
||||
<up-sticky>
|
||||
<view class="bg-fff default-box-padding">
|
||||
<view class="u-flex">
|
||||
<image
|
||||
style="width: 60rpx; height: 60rpx"
|
||||
src="/pageMarket/static/images/coupon_code.png"
|
||||
></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-24">
|
||||
<view class="color-333 font-bold">充值兑换码 </view>
|
||||
<view class="color-666 u-m-t-4 u-font-24"
|
||||
>兑换码直充余额,可当作礼品赠送
|
||||
</view>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
||||
size="18"
|
||||
:disabled="isMainShop()?false:true"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="u-p-t-60 default-box-x-padding">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="shop" @click="showShopModal">适用门店</view>
|
||||
<view
|
||||
class="u-flex status-sel u-row-between bg-fff u-line-1"
|
||||
@click="showStatusModal"
|
||||
>
|
||||
<text class="color-999" v-if="returnStatusText == '全部'">全部</text>
|
||||
<text class="color-333" v-else>{{ returnStatusText }}</text>
|
||||
<up-icon name="arrow-down" size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="default-box-padding">
|
||||
<view
|
||||
v-for="(item, index) in list"
|
||||
class="u-m-b-56 default-box-radius bg-fff default-box-padding"
|
||||
>
|
||||
<view class="u-flex u-row-between">
|
||||
<view>
|
||||
<text class="u-font-32 font-bold color-333">{{ item.name }}</text>
|
||||
<text class="u-font-24 color-666 u-m-l-20"
|
||||
>金额:{{ item.amount }}元</text
|
||||
>
|
||||
</view>
|
||||
<view class="status" :class="['status' + item.status]">{{
|
||||
item.status == 0 ? "有效" : "无效"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-22 color-666 u-font-24 u-flex">
|
||||
<view>
|
||||
<view>{{ item.startTime }} 至 {{ item.endTime }}</view>
|
||||
<view class="u-m-t-16 u-flex">
|
||||
<view>
|
||||
<text>总数:</text>
|
||||
<text class="color-333 u-font-28 font-bold">{{
|
||||
item.total
|
||||
}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="u-m-l-20" >库存:</text>
|
||||
<text class="color-333 u-font-28 font-bold">{{
|
||||
item.stock
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="u-m-t-16">{{ returnCoupon(item) }}</view> -->
|
||||
</view>
|
||||
<view class="min-page bg-f7 u-font-28">
|
||||
<up-sticky>
|
||||
<view class="bg-fff default-box-padding">
|
||||
<view class="u-flex">
|
||||
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/coupon_code.png"></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-24">
|
||||
<view class="color-333 font-bold">充值兑换码</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24">兑换码直充余额,可当作礼品赠送</view>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
||||
size="18"
|
||||
:disabled="isMainShop() ? false : true"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="u-p-t-60 default-box-x-padding">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="shop" @click="showShopModal">适用门店</view>
|
||||
<view class="u-flex status-sel u-row-between bg-fff u-line-1" @click="showStatusModal">
|
||||
<text class="color-999" v-if="returnStatusText == '全部'">全部</text>
|
||||
<text class="color-333" v-else>{{ returnStatusText }}</text>
|
||||
<up-icon name="arrow-down" size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="default-box-padding">
|
||||
<view v-for="(item, index) in list" class="u-m-b-56 default-box-radius bg-fff default-box-padding">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>
|
||||
<text class="u-font-32 font-bold color-333">{{ item.name }}</text>
|
||||
<text class="u-font-24 color-666 u-m-l-20">金额:{{ item.amount }}元</text>
|
||||
</view>
|
||||
<view class="status" :class="['status' + item.status]">{{ item.status == 0 ? '有效' : '无效' }}</view>
|
||||
</view>
|
||||
<view class="u-m-t-22 color-666 u-font-24 u-flex">
|
||||
<view>
|
||||
<view>{{ item.startTime }} 至 {{ item.endTime }}</view>
|
||||
<view class="u-m-t-16 u-flex">
|
||||
<view>
|
||||
<text>总数:</text>
|
||||
<text class="color-333 u-font-28 font-bold">{{ item.total }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="u-m-l-20">库存:</text>
|
||||
<text class="color-333 u-font-28 font-bold">{{ item.stock }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="u-m-t-16">{{ returnCoupon(item) }}</view> -->
|
||||
</view>
|
||||
|
||||
<view class="btn edit" @click="handleEdit(item)">查看</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<view class="btn edit" @click="handleEdit(item)">查看</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<view class="btn del" @click="handleDelete(item)">删除</view>
|
||||
<view class="btn edit" @click="handleEdit(item)">查看</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="isMainShop()">
|
||||
<view style="height: 100rpx"></view>
|
||||
<view class="fixed-bottom">
|
||||
<my-button @click="go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD')"
|
||||
>添加兑换码</my-button
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="isMainShop()">
|
||||
<view style="height: 100rpx"></view>
|
||||
<view class="fixed-bottom">
|
||||
<my-button @click="go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD')">添加兑换码</my-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<Modal v-model="modalData.show" :title="modalData.title" @confirm="handleConfirm">
|
||||
<template v-if="modalData.key == 'selShop'">
|
||||
<view class="default-box-padding">
|
||||
<my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useType"></my-shop-select>
|
||||
</view>
|
||||
</template>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
v-model="modalData.show"
|
||||
:title="modalData.title"
|
||||
@confirm="handleConfirm"
|
||||
>
|
||||
<template v-if="modalData.key == 'selShop'">
|
||||
<view class="default-box-padding">
|
||||
<my-shop-select
|
||||
@shop-select="shopSelect"
|
||||
v-model:selShops="form.shopIdList"
|
||||
v-model:useType="form.useType"
|
||||
></my-shop-select>
|
||||
</view>
|
||||
</template>
|
||||
</Modal>
|
||||
<u-action-sheet
|
||||
:actions="actions"
|
||||
cancelText="取消"
|
||||
:closeOnClickAction="true"
|
||||
round="6"
|
||||
@close="showAction = false"
|
||||
@select="selectStatus"
|
||||
:show="showAction"
|
||||
></u-action-sheet>
|
||||
|
||||
<u-action-sheet
|
||||
:actions="actions"
|
||||
cancelText="取消"
|
||||
:closeOnClickAction="true"
|
||||
round="6"
|
||||
@close="showAction = false"
|
||||
@select="selectStatus"
|
||||
:show="showAction"
|
||||
></u-action-sheet>
|
||||
</view>
|
||||
<my-marketing-mask name="充值兑换码" v-if="isMarketShow(form)"></my-marketing-mask>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress,
|
||||
} from "@dcloudio/uni-app";
|
||||
import Modal from "@/pageMarket/components/modal.vue";
|
||||
import * as rechargeRedemptionApi from "@/http/api/market/rechargeRedemption.js";
|
||||
import { useAccountInfoStore } from "@/store/account.js";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import {isMainShop} from "@/store/account.js";
|
||||
import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
|
||||
import Modal from '@/pageMarket/components/modal.vue';
|
||||
import * as rechargeRedemptionApi from '@/http/api/market/rechargeRedemption.js';
|
||||
import { useAccountInfoStore } from '@/store/account.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { isMainShop, isMarketShow } from '@/store/account.js';
|
||||
const accountInfoStore = useAccountInfoStore();
|
||||
import { ref, reactive, onMounted, computed, watch } from "vue";
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue';
|
||||
const loadFinish = ref(false);
|
||||
const form = reactive({
|
||||
isEnable: 0,
|
||||
useType: "all",
|
||||
shopIdList:[]
|
||||
isEnable: 0,
|
||||
useType: 'all',
|
||||
shopIdList: []
|
||||
});
|
||||
|
||||
const actions = [
|
||||
{
|
||||
name: "全部",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
name: "有效",
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
name: "无效",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
name: '全部',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
name: '有效',
|
||||
value: '0'
|
||||
},
|
||||
{
|
||||
name: '无效',
|
||||
value: '1'
|
||||
}
|
||||
];
|
||||
const returnStatusText = computed(() => {
|
||||
return actions.find((item) => item.value == query.status)?.name || "全部";
|
||||
return actions.find((item) => item.value == query.status)?.name || '全部';
|
||||
});
|
||||
|
||||
function returnCoupon(item) {
|
||||
return item.couponInfoList
|
||||
.reduce((prev, cur) => prev + cur.title + "*" + cur.num + "、", "")
|
||||
.slice(0, -1);
|
||||
return item.couponInfoList.reduce((prev, cur) => prev + cur.title + '*' + cur.num + '、', '').slice(0, -1);
|
||||
}
|
||||
const showAction = ref(false);
|
||||
function selectStatus(item) {
|
||||
console.log(item);
|
||||
query.status = item.value;
|
||||
console.log(item);
|
||||
query.status = item.value;
|
||||
}
|
||||
|
||||
function showStatusModal() {
|
||||
showAction.value = true;
|
||||
showAction.value = true;
|
||||
}
|
||||
|
||||
function showShopModal() {
|
||||
modalData.show = true;
|
||||
modalData.title = "适用门店";
|
||||
modalData.key = "selShop";
|
||||
modalData.show = true;
|
||||
modalData.title = '适用门店';
|
||||
modalData.key = 'selShop';
|
||||
}
|
||||
|
||||
const firstModalTime = ref(0);
|
||||
const modalData = reactive({
|
||||
show: false,
|
||||
title: "",
|
||||
key: "",
|
||||
show: false,
|
||||
title: '',
|
||||
key: ''
|
||||
});
|
||||
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: "确认删除吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
rechargeRedemptionApi
|
||||
.delete({
|
||||
id: item.id,
|
||||
})
|
||||
.then((res) => {
|
||||
uni.showToast({
|
||||
title: "删除成功",
|
||||
icon: "none",
|
||||
});
|
||||
refreshList();
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
uni.showModal({
|
||||
title: '确认删除吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
rechargeRedemptionApi
|
||||
.delete({
|
||||
id: item.id
|
||||
})
|
||||
.then((res) => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
});
|
||||
refreshList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const isEnd = ref(false);
|
||||
const query = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: "",
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: ''
|
||||
});
|
||||
const list = ref([]);
|
||||
function refreshList() {
|
||||
query.pageNum = 1;
|
||||
isEnd.value = false;
|
||||
getList();
|
||||
query.pageNum = 1;
|
||||
isEnd.value = false;
|
||||
getList();
|
||||
}
|
||||
|
||||
function handleEdit(item) {
|
||||
uni.setStorageSync("rechargeRedemption", item);
|
||||
go.to("PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD_DWTAIL", {
|
||||
type: "edit",
|
||||
});
|
||||
uni.setStorageSync('rechargeRedemption', item);
|
||||
go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD_DWTAIL', {
|
||||
type: 'edit'
|
||||
});
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (form.useType == "custom") {
|
||||
if (form.shopIdList.length == 0) {
|
||||
uni.showToast({
|
||||
title: "请选择适用门店",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (form.useType == 'custom') {
|
||||
if (form.shopIdList.length == 0) {
|
||||
uni.showToast({
|
||||
title: '请选择适用门店',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rechargeRedemptionApi.enable({
|
||||
shopIdList: form.shopIdList||[],
|
||||
useType: form.useType,
|
||||
isEnable: form.isEnable,
|
||||
});
|
||||
uni.showToast({
|
||||
title: "修改成功",
|
||||
icon: "none",
|
||||
});
|
||||
modalData.show = false;
|
||||
rechargeRedemptionApi.enable({
|
||||
shopIdList: form.shopIdList || [],
|
||||
useType: form.useType,
|
||||
isEnable: form.isEnable
|
||||
});
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
});
|
||||
modalData.show = false;
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
loadFinish.value = false;
|
||||
if (isEnd.value) {
|
||||
return;
|
||||
}
|
||||
const res = await rechargeRedemptionApi.couponRedemptionList(query);
|
||||
loadFinish.value = true;
|
||||
if (query.pageNum >= res.totalPage * 1) {
|
||||
isEnd.value = true;
|
||||
}
|
||||
if (query.pageNum == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = list.value.concat(res.records || []);
|
||||
}
|
||||
console.log(list.value);
|
||||
query.pageNum++;
|
||||
loadFinish.value = false;
|
||||
if (isEnd.value) {
|
||||
return;
|
||||
}
|
||||
const res = await rechargeRedemptionApi.couponRedemptionList(query);
|
||||
loadFinish.value = true;
|
||||
if (query.pageNum >= res.totalPage * 1) {
|
||||
isEnd.value = true;
|
||||
}
|
||||
if (query.pageNum == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = list.value.concat(res.records || []);
|
||||
}
|
||||
console.log(list.value);
|
||||
query.pageNum++;
|
||||
};
|
||||
|
||||
function getShopInfo() {
|
||||
accountInfoStore.getShopInfo().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
accountInfoStore.getShopInfo().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
watch(
|
||||
() => accountInfoStore.shopInfo.isProductSuggest,
|
||||
(newVal, oldVal) => {
|
||||
if(!isMainShop()) return;
|
||||
if (!loadFinish.value) return;
|
||||
accountInfoStore.editShopInfo({
|
||||
isProductSuggest: newVal,
|
||||
id: accountInfoStore.shopInfo.id,
|
||||
});
|
||||
uni.showToast({
|
||||
title: "修改成功",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
() => accountInfoStore.shopInfo.isProductSuggest,
|
||||
(newVal, oldVal) => {
|
||||
if (!isMainShop()) return;
|
||||
if (!loadFinish.value) return;
|
||||
accountInfoStore.editShopInfo({
|
||||
isProductSuggest: newVal,
|
||||
id: accountInfoStore.shopInfo.id
|
||||
});
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => query.status,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
refreshList();
|
||||
}
|
||||
() => query.status,
|
||||
(newval) => {
|
||||
console.log(newval);
|
||||
refreshList();
|
||||
}
|
||||
);
|
||||
|
||||
async function getConfig() {
|
||||
rechargeRedemptionApi.status().then((res) => {
|
||||
res.shopIdList = res.shopIdList || [];
|
||||
Object.assign(form, res);
|
||||
});
|
||||
rechargeRedemptionApi.status().then((res) => {
|
||||
res.shopIdList = res.shopIdList || [];
|
||||
Object.assign(form, res);
|
||||
});
|
||||
}
|
||||
onReachBottom(() => {
|
||||
console.log("触底");
|
||||
getList();
|
||||
console.log('触底');
|
||||
getList();
|
||||
});
|
||||
onMounted(() => {
|
||||
getShopInfo();
|
||||
getConfig();
|
||||
getShopInfo();
|
||||
getConfig();
|
||||
});
|
||||
onShow(() => {
|
||||
refreshList();
|
||||
refreshList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.status {
|
||||
padding: 8rpx 18rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 8rpx;
|
||||
&.status0 {
|
||||
background-color: rgba(123, 209, 54, 0.12);
|
||||
border-color: rgba(123, 209, 54, 1);
|
||||
color: #7bd136;
|
||||
}
|
||||
&.status1 {
|
||||
border-color: rgba(153, 153, 153, 1);
|
||||
background-color: rgba(153, 153, 153, 0.12);
|
||||
color: #999;
|
||||
}
|
||||
padding: 8rpx 18rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 8rpx;
|
||||
&.status0 {
|
||||
background-color: rgba(123, 209, 54, 0.12);
|
||||
border-color: rgba(123, 209, 54, 1);
|
||||
color: #7bd136;
|
||||
}
|
||||
&.status1 {
|
||||
border-color: rgba(153, 153, 153, 1);
|
||||
background-color: rgba(153, 153, 153, 0.12);
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
padding: 8rpx 42rpx;
|
||||
white-space: nowrap;
|
||||
border-radius: 100rpx;
|
||||
&.del {
|
||||
background-color: #f7f7fa;
|
||||
color: #999;
|
||||
}
|
||||
&.edit {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
padding: 8rpx 42rpx;
|
||||
white-space: nowrap;
|
||||
border-radius: 100rpx;
|
||||
&.del {
|
||||
background-color: #f7f7fa;
|
||||
color: #999;
|
||||
}
|
||||
&.edit {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.fixed-bottom {
|
||||
}
|
||||
.time {
|
||||
margin-left: 30rpx;
|
||||
padding: 4rpx 20rpx;
|
||||
border: 1px solid $my-main-color;
|
||||
border-radius: 8rpx;
|
||||
color: $my-main-color;
|
||||
margin-left: 30rpx;
|
||||
padding: 4rpx 20rpx;
|
||||
border: 1px solid $my-main-color;
|
||||
border-radius: 8rpx;
|
||||
color: $my-main-color;
|
||||
}
|
||||
.shop {
|
||||
background-color: rgba(49, 138, 254, 0.07);
|
||||
color: $my-main-color;
|
||||
border: 1px solid $my-main-color;
|
||||
padding: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: rgba(49, 138, 254, 0.07);
|
||||
color: $my-main-color;
|
||||
border: 1px solid $my-main-color;
|
||||
padding: 20rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.status-sel {
|
||||
min-width: 266rpx;
|
||||
padding: 18rpx 32rpx;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
min-width: 266rpx;
|
||||
padding: 18rpx 32rpx;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user