This commit is contained in:
GaoHao
2024-10-26 16:18:31 +08:00
11 changed files with 1092 additions and 714 deletions

View File

@@ -129,7 +129,7 @@
mode: {
//all date time
type: String,
default: 'all'
default: 'time'
},
yearsLen:{
type: Number,

58
http/yskApi/coupon.js Normal file
View File

@@ -0,0 +1,58 @@
import http from './http.js'
const request=http.request
/**
* 获取优惠券列表
* @returns
*/
export function getTbShopCoupon(data) {
return request({
url: `/api/tbShopCoupon`,
method: 'get',
params: {
shopId: uni.getStorageSync('shopId'),
...data
}
})
}
/**
* 获取优惠券详情
* @returns
*/
export function getTbShopCouponInfo(id) {
return request({
url: `/api/tbShopCoupon/${id}`,
method: 'get',
params: {
}
})
}
/**
* 增加优惠券
* @returns
*/
export function addTbShopCoupon(data) {
return request({
url: `/api/tbShopCoupon`,
method: 'post',
params: {
shopId: uni.getStorageSync('shopId'),
...data
}
})
}
/**
* 删除优惠券
* @returns
*/
export function delTbShopCoupon(data) {
return request({
url: `/api/tbShopCoupon`,
method: 'delete',
params: data
})
}

View File

@@ -16,10 +16,10 @@ import {
import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js';
// 测试服
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
//预发布
let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
// 王伟本地测
// let baseUrl = '/ww'

View File

@@ -0,0 +1,178 @@
<template>
<up-popup :show="show" @close="close" round="20" mode="bottom">
<view class="head">
<text></text>
<text class="title">请选择</text>
<up-icon @tap="close" name="close-circle-fill" color="#333" size="20"></up-icon>
</view>
<view class="content">
<view class="category">
<view class="category_item" @tap="itemClick(item,index)" :class="{active:index===category.active}" v-for="(item,index) in category.list" :key="index">{{item.name}}</view>
</view>
<up-radio-group v-model="goodsValue" @change="groupChange" style="width: 100%;display: initial;">
<view class="goodsList">
<view class="goodsItem" @tap="goodsClick(item,index)" v-for="(item,index) in category.goodsList" :key="index">
<view>{{item.name}}</view>
<up-radio
:key="item.id"
:name="item.id"
@change="groupChange"
>
</up-radio>
</view>
</view>
</up-radio-group>
</view>
<view class="bomBtn">
<view class="affirm" @tap="affirm">确定</view>
</view>
</up-popup>
</template>
<script setup>
import { reactive,ref,onMounted } from 'vue';
import {
$tbShopCategory,
$tbProductV2
} from "@/http/yskApi/goods.js"
const props=defineProps({
show:{
type:Boolean,
default:false
}
})
const emits=defineEmits(['itemClick','close', "affirm"])
const category=reactive({
list:[],
goodsList:[],
active: 0,
query: {
page: 0,
size: 999,
categoryId: '',
sort: "createdAt,desc",
}
})
let goodsValue = ref('');
let show=ref(false)
function itemClick(item,index){
category.active = index;
category.query.categoryId = item.id;
getGoodsList()
}
function goodsClick (item,index) {
goodsValue.value = item.id;
}
function groupChange ( n ) {
// console.log(n)
}
function getCategoryList () {
$tbShopCategory({
page:0,size:200
}).then(res=>{
category.list = res.content;
category.query.categoryId = res.content[0].id
getGoodsList()
})
}
function getGoodsList () {
$tbProductV2(category.query).then(res => {
category.goodsList = res.content.map(v => {
return {
...v,
isSellNone: false,
checked: false,
showDetail: false
}
})
})
}
function open(){
show.value = true;
getCategoryList();
}
function close(){
show.value = false;
category.active = 0;
goodsValue.value = "";
emits('close')
}
/**
* 确认
*/
function affirm() {
let item;
category.goodsList.forEach((v,e)=>{
if ( v.id == goodsValue.value) {
item = v;
}
})
emits('affirm',item)
close();
}
defineExpose({
open,close,affirm
})
</script>
<style lang="scss">
.head{
display: flex;
padding: 32rpx 28rpx;
align-items: center;
justify-content: space-between;
.title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
}
.content{
display: flex;
height: 672rpx;
.category{
min-width: 316rpx;
height: 100%;
overflow-y: auto;
background: #F9F9F9;
.category_item{
padding: 22rpx 24rpx;
border-left: 8rpx solid transparent;
}
.active{
border-left: 8rpx solid #318AFE;
background-color: #fff;
}
}
.goodsList{
height: 100%;
overflow-y: auto;
display: flex;
flex-direction: column;
.goodsItem{
width: 100%;
padding: 22rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
}
}
.bomBtn{
padding: 16rpx 38rpx 32rpx 38rpx;
background-color: #fff;
.affirm{
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: #318AFE;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
}
}
</style>

View File

@@ -1,279 +1,326 @@
<template>
<!-- 基础赠送设置切换 -->
<view class="foundation">
<view :class="[switchTop==1?'active':'']" @click="switchTop =1">
基础设置
</view>
<view :class="[switchTop==2?'active':'']" @click="switchTop=2">
赠送设置
</view>
</view>
<view class="content">
<view class="content1">
<view class="card">
<view class="item">
<view class="lable">优惠券名称</view>
<view class="value">
<up-input v-model="formData.title" placeholder="填写名称" border="none" clearable ></up-input>
</view>
</view>
<view class="item">
<view class="lable">使用门槛</view>
<view class="value">
<view></view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元</view><view>减</view><input v-model="formData.discountAmount" placeholder="填写金额" border="none"></input><view></view>
</view>
</view>
</view>
<view class="card">
<view class="item">
<view class="lable">有效期类型</view>
<view class="value" style="display: flex;flex-direction: column;align-items: flex-start;">
<view>
折扣名称
<up-radio-group v-model="formData.validityType" @change="typeChange('validityType')">
<up-radio name="fixed" label="领券后有效期内可用" style="margin-right: 30rpx;"></up-radio>
<up-radio name="custom" label="固定有效期范围内可用"></up-radio>
</up-radio-group>
</view>
<input type="text" placeholder="填写名称" />
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
折扣%
</view>
<input type="text" placeholder="填写名称" />
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
使用门槛
</view>
<input type="text" placeholder="隔多少元,可用 " />
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
优惠券类型
</view>
<radio-group @change="radioChange" style="margin-top: 16rpx;">
<radio style="transform:scale(0.7)">单次折扣券</radio>
<radio style="transform:scale(0.7)">储值折扣券</radio>
</radio-group>
<view class="siwtichStyle">
<span>最大抵扣金额</span>
<switch color="#FFCC33" style="transform:scale(0.7)" />
</view>
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
抵扣规则
</view>
从最高价开始抵扣
<view class="siwtichStyle">
<span>可抵扣件数</span>
<switch color="#FFCC33" style="transform:scale(0.7)" />
</view>
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
有效期类型
</view>
领券后有效期内可用
<view class="siwtichStyle">
<span>有效期</span>
<input type="text" placeholder="填写天数 " />
</view>
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
隔天生效
</view>
<input type="text" placeholder="隔多少天,生效 " />
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content1">
<view>
总发放数量
</view>
<input type="text" placeholder="填写数量" />
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
</view>
<view class="content2">
<view class="">
可用门店
</view>
<view class="">
<span>进本店可用</span>
<span>></span>
</view>
</view>
<view class="content2">
<view class="">
可用商品
</view>
<view class="">
<span>指定商品可用</span>
<span>></span>
<view class="date" v-if="formData.validityType=='custom'">
<!-- {{formData.useStartTime +''+ formData.useEndTime}} -->
<view @click="typeChange('validityType')">{{ formData.validStartTime || '开始时间'}}</view>--
<view @click="typeChange('validityType')">{{ formData.validEndTime || '结束时间'}}</view>
</view>
<view class="siwtichStyle">
<!-- <span>选择商品</span> -->
<!-- <view class=""> -->
<span>选择商品</span>
<input type="text" placeholder="选择指定商品 " />
<span>></span>
<!-- </view> -->
</view>
</view>
<view class="content2">
<view class="">
</view>
<view class="">
<span>更多设置</span>
<span>></span>
<view class="item">
<view class="lable">有效期</view>
<view class="value">
<up-input v-model="formData.validDays" placeholder="填写天数" border="none"></up-input>
</view>
</view>
<view class="content2">
<view class="item">
<view class="lable">隔天生效<up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon></view>
<view class="value">
<view></view><input v-model="formData.daysToTakeEffect" placeholder="填写天数" border="none" ></input><view>天生效</view>
</view>
</view>
<view class="item">
<view class="lable">可用日期</view>
<view class="value">
<up-checkbox-group v-model="formData.userDays" placement="row" @change="checkboxChange" >
<up-checkbox
:customStyle="{marginBottom: '8px',marginRight: '15px'}"
v-for="(item, index) in pageData.value"
:key="index"
:label="item.name"
:name="item.name"
>
</up-checkbox>
</up-checkbox-group>
</view>
</view>
<view class="item">
<view class="lable">指定时间段可用</view>
<view class="value" style="display: flex;flex-direction: column;align-items: flex-start;">
<view>
指定时间段可用
<up-radio-group v-model="formData.useTimeType" >
<up-radio name="all" label="全时段可用" style="margin-right: 30rpx;"></up-radio>
<up-radio name="custom" label="指定时段可用"></up-radio>
</up-radio-group>
</view>
<radio-group @change="radioChange" style="margin-top: 16rpx;">
<radio style="transform:scale(0.7)">全时段可用</radio>
<radio style="transform:scale(0.7)">指定时段可用</radio>
</radio-group>
</view>
<view class="content2">
<view class="">
发放方式
</view>
<view class="">
<span>用户不可自行领取</span>
<span>></span>
<view class="time" v-if="formData.useTimeType=='custom'">
<!-- {{formData.useStartTime +''+ formData.useEndTime}} -->
<view @click="useTimeChange('useStartTime')">{{ formData.useStartTime || '开始时间'}}</view>--
<view @click="useTimeChange('useEndTime')">{{ formData.useEndTime || '结束时间'}}</view>
</view>
</view>
<view class="content1">
<view>
每人领取限量
</view>
不限量
<hr style="margin-top: 24rpx;color: #E5E5E5;" />
<view class="siwtichStyle2">
<span>不限量</span>
<switch color="#FFCC33" style="transform:scale(0.7)" />
</view>
</view>
<view class="card">
<view class="item">
<view class="lable">总发放数量
<up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon>
</view>
<view class="value">
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
</view>
</view>
</view>
<view class="bottomPop">
<button @click="save">保存</button>
</view>
<up-datetime-picker
:show="pageData.useTimeShow"
v-model="pageData.useTime"
mode="time"
@cancel="timeCancel"
@confirm="timeConfirm"
></up-datetime-picker>
<my-date-pickerview @confirm="datePickerConfirm" :mode="pageData.mode" ref="datePicker"></my-date-pickerview>
<up-modal :show="pageData.show" :title="pageData.title" @confirm="pageData.show = false" ></up-modal>
</view>
</template>
<script setup>
import go from '@/commons/utils/go.js'
import {
reactive,
ref,
toRef,
watch
ref
} from 'vue';
let switchTop = ref(1)
import { onLoad, onShow } from '@dcloudio/uni-app';
import { getTbShopCouponInfo, addTbShopCoupon } from '@/http/yskApi/coupon.js'
const pageData = reactive({
value: [
{ name: "周一", },
{ name: "周二", },
{ name: "周三", },
{ name: "周四", },
{ name: "周五", },
{ name: "周六", },
{ name: "周日", },
],
mode: "",
title: "",
show: false,
useTimeShow: false,
useTime: "",
dateType: "",
sueDateType: "",
})
const formData = reactive({
type: '1',
title: '',
fullAmount: null,
discountAmount: null,
validityType: 'fixed',
validStartTime: '',
validEndTime: '',
userDays: [],
useTimeType: 'all',
useStartTime: '',
useEndTime: '',
validDays: null,
daysToTakeEffect: null,
number: null,
})
onLoad((options) => {
if ( options.type == 'info' ) {
pageData.id = options.id;
getConponInfo();
}
})
let datePicker = ref(null)
let refTime = ref(null)
/**
* 查看生效时间/发放数量提示
*/
let modalShow = ( type ) => {
if ( type == 1) {
pageData.title = "领取后0天后的0点0分生效";
} else {
pageData.title = "限用户自行领取,(当库存为 0时集草等活动仍会赠送";
}
pageData.show = true;
}
/**
* 获取详情
*/
let getConponInfo = () => {
getTbShopCouponInfo(pageData.id).then((res) => {
// formData = res;
for (let item in res) {
formData[item] = res[item]
}
formData.userDays = formData.userDays.split(",");
console.log(formData)
})
}
let typeChange = ( type ) =>{
pageData.dateType = type;
pageData.mode = 'date'
if ( formData.validityType == "custom") {
datePicker.value.open()
}
}
/**
* 指定时间段选择
*/
let useTimeChange = ( type ) => {
console.log(type)
pageData.sueDateType = type;
pageData.mode = 'time';
pageData.useTimeShow = true;
}
/**
* 关闭时间段弹窗
*/
let timeCancel = () => {
pageData.useTimeShow = false;
}
/**
* 确认时间端选择
*/
let timeConfirm = () => {
pageData.useTimeShow = false;
console.log(pageData.useTime)
if ( pageData.sueDateType == 'useStartTime') { formData.useStartTime = pageData.useTime}
if ( pageData.sueDateType == 'useEndTime') { formData.useEndTime = pageData.useTime}
}
/**
* 有效期选择
*/
let datePickerConfirm = (data) => {
console.log(pageData.dateType)
if ( pageData.dateType == 'validityType') {
// .substring(0,10)
formData.validStartTime = data.start;
formData.validEndTime = data.end;
}
}
/**
* 保存
*/
let save = () => {
formData.userDays = formData.userDays.toString();
let params = {
...formData
}
console.log(params)
addTbShopCoupon(params).then((res) => {
// console.log(res)
go.back(1)
})
}
</script>
<style lang="scss">
.foundation {
width: 694rpx;
height: 70rpx;
background: #E6F0FF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
align-items: center;
margin: 36rpx auto;
>view {
text-align: center;
width: 344rpx;
height: 56rpx;
line-height: 56rpx;
color: #318AFE;
}
.active {
margin: auto;
width: 344rpx;
height: 56rpx;
background: #318AFE;
color: #fff;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
}
.content {
width: 750rpx;
background: #F9F9F9;
padding: 32rpx;
padding: 32rpx 28rpx 150rpx 28rpx;
.content1 {
.card{
padding: 32rpx 24rpx;
background-color: #fff;
padding: 32rpx 24rpx;
>input {
margin-top: 16rpx;
}
>view {
font-family: Source Han Sans CN, Source Han Sans CN;
margin-bottom: 32rpx;
.item{
padding-bottom: 24rpx;
border-bottom: 2rpx solid #E5E5E5;
margin-bottom: 24rpx;
.lable{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.siwtichStyle {
margin-top: 24rpx;
margin-bottom: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24rpx;
width: 646rpx;
height: 104rpx;
background: #F9F9F9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
.siwtichStyle2 {
margin-top: 24rpx;
.value{
display: flex;
justify-content: flex-start;
align-items: center;
input{
width: 150rpx;
text-align: center;
}
.date,.time{
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24rpx;
width: 646rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
}
.content2 {
padding: 32rpx 24rpx;
margin: 32rpx 0;
box-sizing: border-box;
width: 694rpx;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
>view:first-child {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
>view:nth-child(2) {
display: flex;
justify-content: space-between;
margin-top: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
font-size: 26rpx;
color: #999999;
margin-top: 10rpx;
view{
border: 1rpx solid #999;
padding: 10rpx 20rpx;
border-radius: 10rpx
}
>view:nth-child(3) {
display: flex;
justify-content: space-between;
margin-top: 16rpx;
background: #FFFFFF;
width: 646rpx;
height: 154rpx;
background: #F9F9F9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
view:nth-child(1){
margin-right: 10rpx;
}
.siwtichStyle {
margin-top: 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24rpx;
width: 646rpx;
height: 104rpx;
background: #F9F9F9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
view:nth-child(2){
margin-left: 10rpx;
}
}
.time{
view{
padding: 10rpx 30rpx;
}
}
}
}
.item:last-child{
border-bottom: none;
margin-bottom: 0;
}
}
.bottomPop{
position: fixed;
bottom: 0;
left: 0;
height: 150rpx;
width: 100%;
background-color: #fff;
>button {
width: 530rpx;
margin: 30rpx 0;
margin-left: 50%;
transform: translateX(-50%);
height: 80rpx;
line-height: 80rpx;
color: #fff;
background: #318AFE;
border-radius: 56rpx 56rpx 56rpx 56rpx;
}
}
}

View File

@@ -0,0 +1,206 @@
<template>
<view class="content">
<view class="card">
<view class="item">
<view class="lable">商品兑换券名称</view>
<view class="value">
<up-input v-model="formData.title" placeholder="填写名称" border="none" clearable ></up-input>
</view>
</view>
<view class="item">
<view class="lable">使用门槛</view>
<view class="value">
<view></view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>可用</view>
</view>
</view>
<view class="item">
<view class="lable">总发放数量</view>
<view class="value">
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
</view>
</view>
</view>
<view class="card">
<view class="item">
<view class="lable">指定抵扣商品</view>
<view class="value">
<view class="selectGoods" @tap="selectGoodsOpen">
<view>
<view class="title">选择商品</view>
<view class="goodsName" v-if='formData.products.length <= 0'>选择指定商品</view>
<view class="goodsName" v-else>
<view class="goodsItem" v-for="(item,index) in formData.products" :key="index">
<view class="productName">{{item.name}}</view><up-input @tap.stop="stop" style="border-bottom: 1rpx solid #666;" v-model="item.num" placeholder="填写数量" border="none" ></up-input>
</view>
</view>
</view>
<up-icon name="arrow-right" color="#9F9F9F" size="22"></up-icon>
</view>
</view>
</view>
</view>
<view class="bottomPop">
<button @click="save">保存</button>
</view>
<select-goods ref="goods" @affirm="affirm"></select-goods>
</view>
</template>
<script setup>
import go from '@/commons/utils/go.js'
import myActionSheet from '@/components/my-components/my-action-sheet';
import selectGoods from './components/select-goods';
import { getTbShopCouponInfo, addTbShopCoupon } from '@/http/yskApi/coupon.js'
import { reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const pageData = reactive({
id: null,
goodsData: null,
title: "",
show: false,
})
let formData = reactive({
title: "",
type: '2',
fullAmount: null,
number: null,
products: []
})
onLoad((options) => {
if ( options.type == 'info' ) {
pageData.id = options.id;
getConponInfo();
}
})
let goods = ref(null)
let selectGoodsOpen = () => {
goods.value.open();
}
let getConponInfo = () => {
getTbShopCouponInfo(pageData.id).then((res) => {
// formData = res;
for (let item in res) {
formData[item] = res[item]
}
console.log(formData)
})
}
let stop = () => { }
let affirm = (item) => {
pageData.goodsData = item;
formData.products = [];
formData.products.push({
productId: item.id,
name: item.name,
num: null
})
}
/**
* 保存
*/
let save = () => {
let params = {
...formData
}
addTbShopCoupon(params).then((res) => {
go.back(1)
})
}
</script>
<style lang="scss">
.content {
background: #F9F9F9;
padding: 32rpx 28rpx 150rpx 28rpx;
.card{
padding: 32rpx 24rpx;
background-color: #fff;
margin-bottom: 32rpx;
.item{
padding-bottom: 24rpx;
border-bottom: 2rpx solid #E5E5E5;
margin-bottom: 24rpx;
.lable{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
display: flex;
align-items: center;
}
.value{
display: flex;
justify-content: flex-start;
align-items: center;
input{
width: 150rpx;
text-align: center;
}
.selectGoods{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 16rpx;
background: #F9F9F9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
.goodsName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.goodsItem{
display: flex;
align-items: center;
.productName{
margin-right: 20rpx;
}
}
}
}
}
.item:last-child{
border-bottom: none;
margin-bottom: 0;
}
}
.bottomPop{
position: fixed;
bottom: 0;
left: 0;
height: 150rpx;
width: 100%;
background-color: #fff;
>button {
width: 530rpx;
margin: 30rpx 0;
margin-left: 50%;
transform: translateX(-50%);
height: 80rpx;
line-height: 80rpx;
color: #fff;
background: #318AFE;
border-radius: 56rpx 56rpx 56rpx 56rpx;
}
}
}
</style>

View File

@@ -1,353 +1,209 @@
<template>
<!-- 顶部菜单 -->
<view class="tagClass">
<view class="tag-item" @tap="pageData.status.active=index" :class="{active:index===pageData.status.active}"
<view class="tag-item" @tap="tagClick(item)" :class="{active:item.type===pageData.query.type}"
v-for="(item,index) in pageData.status.list" :key="index">
{{item}}
{{item.name}}
</view>
</view>
<!-- 搜搜 -->
<view class="search">
<view class="inputsearch">
搜索优惠券名称
</view>
<!-- <view class="search">
<up-input
placeholder="搜索优惠券名称"
prefixIcon="search"
shape="circle"
border="none"
fontSize="14px"
prefixIconStyle="font-size: 28px;color: #999;"
:customStyle="{backgroundColor:'#F9F9F9',padding: '10rpx 18rpx'}"
></up-input>
<view class="searchBtn">
搜索
</view>
</view>
</view> -->
<!-- 内容 -->
<view class="couponContent">
<view class="couponContentList">
<view class="couponContent" v-for="(item,index) in pageData.couponList" :key="index">
<view class="couponContentListTop">
<view>
充值20元优惠券
</view>
<view>
ID:258792
</view>
<view class="title"> {{ item.title }} </view>
<view> ID:{{item.id}} </view>
</view>
<view class="couponContentListcontent">
<view>
<view>
使用门槛
<view> 使用门槛 </view>
<view> {{ item.fullAmount }} 元减 {{ item.discountAmount }} </view>
</view>
<view>
满200.00元减20.00
</view>
<view> 领取方式 </view>
<view> 用户不可自行领取 </view>
</view>
<view>
<view>
券类型
</view>
<view>
店铺领取可用
</view>
</view>
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
使用门槛门槛
</view>
<view>
满200.00元减20.00
</view>
<view> 有效期 </view>
<view> 领券后{{ item.validDays }}天过期 </view>
</view>
<view class="JQclass">
<image :src="'/static/coupon/qrcode.svg'" mode="scaleToFill" />
</view>
</view>
<view class="couponContentListcontent2">
<view class="">
<view class="">
1000
<view class="num"> {{ item.number }} </view>
<view class="lable"> 发放数量 </view>
</view>
<view class="">
发放数量
</view>
<view class="num"> {{ item.number-item.leftNumber }} </view>
<view class="lable"> 已领取 </view>
</view>
<view class="">
<view class="">
1000
<view class="num"> {{ item.leftNumber }} </view>
<view class="lable"> 剩余 </view>
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
<view class="num"> {{ item.useNumber }} </view>
<view class="lable"> 已使用 </view>
</view>
</view>
<view class="couponContentListbottom">
<button>编辑</button>
<button>删除</button>
<button>同步</button>
<button @tap="editCoupon(item)">编辑</button>
<button @tap="delCoupon(item)">删除</button>
</view>
</view>
<template v-if="pageData.couponList.length">
<my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination>
</template>
</view>
<view class="couponContent">
<view class="couponContentList">
<view class="couponContentListTop">
<view>
充值20元优惠券
</view>
<view>
ID:258792
</view>
</view>
<view class="couponContentListcontent">
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
券类型
</view>
<view>
店铺领取可用
</view>
</view>
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
使用门槛门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view class="JQclass">
</view>
</view>
<view class="couponContentListcontent2">
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
</view>
<view class="couponContentListbottom">
<button>编辑</button>
<button>删除</button>
<button>同步</button>
</view>
</view>
</view>
<view class="couponContent">
<view class="couponContentList">
<view class="couponContentListTop">
<view>
充值20元优惠券
</view>
<view>
ID:258792
</view>
</view>
<view class="couponContentListcontent">
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
券类型
</view>
<view>
店铺领取可用
</view>
</view>
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
使用门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view>
<view>
使用门槛门槛
</view>
<view>
满200.00元减20.00
</view>
</view>
<view class="JQclass">
</view>
</view>
<view class="couponContentListcontent2">
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
<view class="">
<view class="">
1000
</view>
<view class="">
发放数量
</view>
</view>
</view>
<view class="couponContentListbottom">
<button>编辑</button>
<button>删除</button>
<button>同步</button>
</view>
</view>
</view>
<view class="bottomPop">
<button @click="adddiscount">+添加满减优惠券</button>
<button @click="addCoupon">+添加{{pageData.status.tagName}}</button>
</view>
</template>
<script setup>
import go from '@/commons/utils/go.js'
import { getTbShopCoupon , delTbShopCoupon} from '@/http/yskApi/coupon.js'
import {
reactive,
ref,
toRef,
watch
onMounted
} from 'vue';
import { onLoad, onShow,onPageScroll,
onPullDownRefresh,
onReachBottom, } from '@dcloudio/uni-app';
const pageData = reactive({
status: {
list: ['全部', '储存中储存中', '已取完', '已过期', '储存中', '已取完', '已过期', ],
list: [
{name: '优惠券', type: 1},
{name: '商品兑换券', type: 2},
],
tagName: "优惠券",
active: 0,
}
},
query: {
type: 1,
page: 1,
size: 10,
},
couponList: [],
totalElements: 0,
})
const adddiscount = ()=>{
onShow(() => {
getCoupon();
})
onReachBottom(() => {
// pageData.query.page++
// getCoupon()
})
/**
* tag切换
*/
let tagClick = ( item ) => {
pageData.query.type = item.type;
pageData.status.tagName = item.name;
pageData.query.page = 1;
getCoupon();
}
// 获取优惠券列表
let getCoupon = () => {
let params = pageData.query;
getTbShopCoupon(params).then((res) => {
console.log(res)
pageData.couponList = res.content;
pageData.totalElements = res.totalElements;
})
}
// 页数改变事件
function pageChange(page) {
console.log(page)
pageData.query.page = page
getCoupon()
}
/**
* 添加
*/
let addCoupon = ()=>{
if ( pageData.query.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS')
} else {
go.to('PAGES_COUPON_CERTIFICATE')
}
}
/**
* 修改
*/
let editCoupon = (item)=>{
console.log(item.id)
if ( item.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', id: item.id})
} else {
go.to('PAGES_COUPON_CERTIFICATE',{type: 'info', id: item.id})
}
}
/**
* 删除
*/
let delCoupon = (item) => {
delTbShopCoupon([item.id]).then((res) => {
getCoupon();
})
}
</script>
<style lang='scss'>
body{
background-color: #f9f9f9;
}
.tagClass {
width: 100%;
white-space: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
margin-top: 44rpx;
padding-top: 44rpx;
padding: 32rpx 28rpx;
background-color: #fff;
.tag-item {
display: inline-block;
padding: 8rpx 22rpx;
margin-left: 16rpx;
padding: 10rpx 24rpx;
margin-right: 32rpx;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text-align: center;
color: #666;
font-weight: 400;
font-size: 28rpx;
color: #666666;
background: #F7F7FA;
&.active {
background: #E6F0FF;
color: $my-main-color;
color: #318AFE;
}
}
}
@@ -361,7 +217,8 @@
justify-content: center;
align-items: center;
padding: 32rpx;
background-color: #fff;
margin-bottom: 32rpx;
.inputsearch {
color: #999999;
width: 542rpx;
@@ -382,24 +239,30 @@
border-radius: 32rpx 32rpx 32rpx 32rpx;
}
}
.couponContent {
background-color: #f9f9f9;
padding: 32rpx 0;
.couponContentList {
width: 694rpx;
height: 544rpx;
background: #FFFFFF;
/* width: 694rpx; */
/* height: 544rpx; */
margin: 32rpx auto 0;
margin-bottom: 32rpx;
padding: 0 28rpx 182rpx 28rpx;
}
.couponContent {
/* background-color: #f9f9f9; */
border-radius: 18rpx 18rpx 18rpx 18rpx;
margin: 0 auto;
background: #FFFFFF;
padding: 32rpx 24rpx;
margin-bottom: 32rpx;
.couponContentListTop {
display: flex;
justify-content: space-between;
align-items: center;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
width: 98rpx;
height: 36rpx;
@@ -454,7 +317,7 @@
.JQclass {
width: 48rpx;
height: 48rpx;
background-color: #318AFE;
/* background-color: #318AFE; */
position: absolute;
right: 48rpx;
top: 90rpx;
@@ -466,21 +329,32 @@
justify-content: space-between;
text-align: center;
padding-top: 24rpx;
.num{
font-weight: bold;
font-size: 24rpx;
color: #333333;
margin-bottom: 16rpx;
}
.lable{
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
.couponContentListbottom {
margin-top: 24rpx;
overflow: hidden;
>button {
float: right;
width: 140rpx;
height: 56rpx;
margin-right: 22rpx;
margin-left: 22rpx;
line-height: 56rpx;
text-align: center;
background: #FFFFFF;
color: #999;
background: #F7F7FA;
border-radius: 28rpx 28rpx 28rpx 28rpx;
border: 2rpx solid #E5E5E5;
font-size: 28rpx;
}
@@ -490,6 +364,8 @@
}
}
}
.couponContent:last-of-type{
/* margin-bottom: 150rpx; */
}
.bottomPop {

View File

@@ -891,7 +891,13 @@
"pageId": "PAGES_COUPON_DISCOUNTCOUPONS",
"path": "discountCoupons",
"style": {
"navigationBarTitleText": "添加折扣券"
"navigationBarTitleText": "优惠券"
}
}, {
"pageId": "PAGES_COUPON_CERTIFICATE",
"path": "editCertificate",
"style": {
"navigationBarTitleText": "商品兑换券"
}
}]
},
@@ -1088,6 +1094,7 @@
}
]
}
],
"globalStyle": {
"navigationBarTextStyle": "black",

View File

@@ -145,6 +145,11 @@
icon: '/static/indexImg/icon-cashier.svg',
pageUrl: 'PAGES_SHOP_SETUP',
},
{
title: '优惠券',
icon: '/static/coupon/icon_coupon.svg',
pageUrl: 'PAGES_COUPON_INDEX',
},
{
title: '订阅通知',
icon: '/static/indexImg/icon-notification.svg',
@@ -225,6 +230,10 @@
// pageUrl: 'PAGES_AD_LIST',
// entId: 'ENT_ADVERT_CONTROL'
// },
// {
// title: '营销红包',
// icon: '/static/indexImg/red-envelope.svg',
@@ -232,11 +241,6 @@
// entId: 'ENT_MCH_MEMBER'
// },
// {
// title: '优惠券',
// icon: '/static/indexImg/red-envelope.svg',
// pageUrl: 'PAGES_COUPON_INDEX'
// },
{
title: '退出登录',

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><defs><style>.a{fill:#80bcff;}.b{clip-path:url(#a);}.c{clip-path:url(#b);}.d{fill:#197dff;}.e{fill:#4c99fe;}</style><clipPath id="a"><rect class="a" width="32" height="32" transform="translate(41 962)"/></clipPath><clipPath id="b"><rect class="a" width="32" height="32" transform="translate(338 862)"/></clipPath></defs><g class="b" transform="translate(-41 -962)"><g class="c" transform="translate(-297 100)"><path class="d" d="M27.706,22.243h0V19.407a1.449,1.449,0,0,0-.824-1.483c-1.848-.857-2.472-1.605-2.472-2.965s.577-2.054,2.472-2.966l.038-.023c.341.822,1.073,1.335,2.613,1.832a1.449,1.449,0,0,1,1,1.371l.542,4.415A2.362,2.362,0,0,1,28.89,22.1l-1.183.145Zm0-13.526V6.061a2.36,2.36,0,0,0-2.472-2.224H.521A2.756,2.756,0,0,0,0,3.886a2.6,2.6,0,0,1,1.649-.854L26.18.021A2.775,2.775,0,0,1,26.518,0,2.323,2.323,0,0,1,28.9,1.927l.542,4.416a1.374,1.374,0,0,1-.636,1.572,9.66,9.66,0,0,0-1.1.8Z" transform="translate(338.913 865.612)"/><path class="e" d="M93.989,182.151a1.367,1.367,0,0,0,.824-1.483V176.22A2.358,2.358,0,0,0,92.341,174H67.627a2.357,2.357,0,0,0-2.471,2.224v4.448a1.326,1.326,0,0,0,.824,1.483c1.125.472,2.471,1.425,2.471,2.966a2.936,2.936,0,0,1-2.422,2.962,1.668,1.668,0,0,0-.872,1.486v4.448a2.358,2.358,0,0,0,2.471,2.225H92.341a2.358,2.358,0,0,0,2.471-2.225v-4.448a1.45,1.45,0,0,0-.824-1.483c-1.8-.835-2.471-1.578-2.471-2.965s.629-2.079,2.471-2.966Zm-9.062,2.6a.393.393,0,0,1-.412.371H80.808V186.6h3.707a.393.393,0,0,1,.412.371v.741a.393.393,0,0,1-.412.371H80.808v2.6a.393.393,0,0,1-.412.371h-.824a.393.393,0,0,1-.412-.371v-2.6H75.453a.393.393,0,0,1-.412-.371v-.741a.393.393,0,0,1,.412-.371H79.16v-1.483H75.453a.393.393,0,0,1-.412-.371V184a.393.393,0,0,1,.412-.371h3.119l-3.386-3.274a.361.361,0,0,1,0-.516l.524-.516a.375.375,0,0,1,.524,0l3.745,3.622,3.744-3.62a.378.378,0,0,1,.528,0l.528.52a.364.364,0,0,1,0,.52L81.4,183.634h3.11a.393.393,0,0,1,.412.371v.742Zm0,0" transform="translate(273.002 694.855)"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

1
static/coupon/qrcode.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24.1" height="24.1" viewBox="0 0 24.1 24.1"><defs><style>.a{fill:#333;}</style></defs><path class="a" d="M179.826,184.148v-2.183h-2.231v2.185Zm3.33,0a1,1,0,0,0,.993-.993v-1.192h-2.139v2.183m-13.222-21.914v6.555h-6.555v-6.555h6.555m1.192-2.185h-8.938a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h8.938a1,1,0,0,0,.993-.993v-8.938a1,1,0,0,0-.993-.993Zm-4.469,5.462-1.092,0a1.092,1.092,0,1,0,1.092-1.092A1.092,1.092,0,0,0,164.419,165.512Zm17.545-3.277v6.555H175.41v-6.555h6.555m1.192-2.185h-8.938a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h8.938a1,1,0,0,0,.993-.993v-8.938a1,1,0,0,0-.993-.993Zm-4.469,5.462-1.092,0a1.092,1.092,0,1,0,1.092-1.092A1.092,1.092,0,0,0,177.595,165.512Zm-8.806,9.9v6.555h-6.555V175.41h6.555m1.192-2.185h-8.938a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h8.938a1,1,0,0,0,.993-.993v-8.938a1,1,0,0,0-.993-.993Zm-4.469,5.462-1.092,0a1.092,1.092,0,1,0,1.092-1.092A1.092,1.092,0,0,0,164.419,178.688Zm18.737-5.462h-1.218v4.37h-2.185v-4.37h-5.535a1,1,0,0,0-.993.993v8.938a1,1,0,0,0,.993.993h1.192V177.6h2.185v2.185h6.555v-5.562A1,1,0,0,0,183.156,173.225Z" transform="translate(-160.049 -160.05)"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB