新增优惠券
This commit is contained in:
@@ -129,7 +129,7 @@
|
|||||||
mode: {
|
mode: {
|
||||||
//all date time
|
//all date time
|
||||||
type: String,
|
type: String,
|
||||||
default: 'all'
|
default: 'time'
|
||||||
},
|
},
|
||||||
yearsLen:{
|
yearsLen:{
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|||||||
58
http/yskApi/coupon.js
Normal file
58
http/yskApi/coupon.js
Normal 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
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -16,10 +16,10 @@ import {
|
|||||||
import infoBox from "@/commons/utils/infoBox.js"
|
import infoBox from "@/commons/utils/infoBox.js"
|
||||||
import go from '@/commons/utils/go.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'
|
// let baseUrl = '/ww'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<view class="head">
|
<view class="head">
|
||||||
<text></text>
|
<text></text>
|
||||||
<text class="title">请选择</text>
|
<text class="title">请选择</text>
|
||||||
<up-icon name="close-circle-fill" color="#333" size="20"></up-icon>
|
<up-icon @tap="close" name="close-circle-fill" color="#333" size="20"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="category">
|
<view class="category">
|
||||||
@@ -65,7 +65,7 @@ import {
|
|||||||
goodsValue.value = item.id;
|
goodsValue.value = item.id;
|
||||||
}
|
}
|
||||||
function groupChange ( n ) {
|
function groupChange ( n ) {
|
||||||
console.log(n)
|
// console.log(n)
|
||||||
}
|
}
|
||||||
function getCategoryList () {
|
function getCategoryList () {
|
||||||
$tbShopCategory({
|
$tbShopCategory({
|
||||||
@@ -78,7 +78,6 @@ import {
|
|||||||
}
|
}
|
||||||
function getGoodsList () {
|
function getGoodsList () {
|
||||||
$tbProductV2(category.query).then(res => {
|
$tbProductV2(category.query).then(res => {
|
||||||
console.log(res);
|
|
||||||
category.goodsList = res.content.map(v => {
|
category.goodsList = res.content.map(v => {
|
||||||
return {
|
return {
|
||||||
...v,
|
...v,
|
||||||
@@ -104,18 +103,14 @@ import {
|
|||||||
* 确认
|
* 确认
|
||||||
*/
|
*/
|
||||||
function affirm() {
|
function affirm() {
|
||||||
console.log(goodsValue.value)
|
let item;
|
||||||
// let params = {
|
category.goodsList.forEach((v,e)=>{
|
||||||
// coverImg: vdata.imgUrlList,
|
if ( v.id == goodsValue.value) {
|
||||||
// consId: itemData.value.consId,
|
item = v;
|
||||||
// amount: vdata.stockNumber,
|
}
|
||||||
// shopId: uni.getStorageSync("shopId"),
|
})
|
||||||
// }
|
emits('affirm',item)
|
||||||
// tbConsInfoFlowfrmLoss(params).then((res) => {
|
close();
|
||||||
// show.value = false;
|
|
||||||
// vdata.imgUrlList = [];
|
|
||||||
// vdata.stockNumber = 1;
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open,close,affirm
|
open,close,affirm
|
||||||
|
|||||||
@@ -4,42 +4,50 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">优惠券名称</view>
|
<view class="lable">优惠券名称</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input placeholder="填写名称" border="none" clearable ></up-input>
|
<up-input v-model="formData.title" placeholder="填写名称" border="none" clearable ></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">使用门槛</view>
|
<view class="lable">使用门槛</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<view>满</view><input placeholder="填写金额" border="none"></input><view>元</view>,<view>减</view><input placeholder="填写金额" border="none"></input><view>元</view>
|
<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>
|
||||||
</view>
|
</view>
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">有效期类型</view>
|
<view class="lable">有效期类型</view>
|
||||||
<view class="value">
|
<view class="value" style="display: flex;flex-direction: column;align-items: flex-start;">
|
||||||
<up-radio-group v-model="saveData.type">
|
<view>
|
||||||
<up-radio name="1" label="领券后有效期内可用" style="margin-right: 30rpx;"></up-radio>
|
<up-radio-group v-model="formData.validityType" @change="typeChange('validityType')">
|
||||||
<up-radio name="0" label="固定有效期范围内可用"></up-radio>
|
<up-radio name="fixed" label="领券后有效期内可用" style="margin-right: 30rpx;"></up-radio>
|
||||||
</up-radio-group>
|
<up-radio name="custom" label="固定有效期范围内可用"></up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">有效期(天)</view>
|
<view class="lable">有效期(天)</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input placeholder="填写天数" border="none"></up-input>
|
<up-input v-model="formData.validDays" placeholder="填写天数" border="none"></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<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="lable">隔天生效<up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon></view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<view>隔</view><input placeholder="填写天数" border="none" ></input><view>天生效</view>
|
<view>隔</view><input v-model="formData.daysToTakeEffect" placeholder="填写天数" border="none" ></input><view>天生效</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">可用日期</view>
|
<view class="lable">可用日期</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-checkbox-group v-model="checkboxValue1" placement="row" @change="checkboxChange" >
|
<up-checkbox-group v-model="formData.userDays" placement="row" @change="checkboxChange" >
|
||||||
<up-checkbox
|
<up-checkbox
|
||||||
:customStyle="{marginBottom: '8px',marginRight: '15px'}"
|
:customStyle="{marginBottom: '8px',marginRight: '15px'}"
|
||||||
v-for="(item, index) in pageData.value"
|
v-for="(item, index) in pageData.value"
|
||||||
@@ -53,11 +61,18 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">指定时间段可用</view>
|
<view class="lable">指定时间段可用</view>
|
||||||
<view class="value">
|
<view class="value" style="display: flex;flex-direction: column;align-items: flex-start;">
|
||||||
<up-radio-group v-model="saveData.timeType">
|
<view>
|
||||||
<up-radio name="1" label="全时段可用" style="margin-right: 30rpx;"></up-radio>
|
<up-radio-group v-model="formData.useTimeType" >
|
||||||
<up-radio name="0" label="指定时段可用"></up-radio>
|
<up-radio name="all" label="全时段可用" style="margin-right: 30rpx;"></up-radio>
|
||||||
</up-radio-group>
|
<up-radio name="custom" label="指定时段可用"></up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
<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>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -67,24 +82,32 @@
|
|||||||
<up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon>
|
<up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input v-model="saveData.num" placeholder="填写数量" border="none" clearable ></up-input>
|
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottomPop">
|
<view class="bottomPop">
|
||||||
<button @click="save">保存</button>
|
<button @click="save">保存</button>
|
||||||
</view>
|
</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>
|
<up-modal :show="pageData.show" :title="pageData.title" @confirm="pageData.show = false" ></up-modal>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import go from '@/commons/utils/go.js'
|
||||||
import {
|
import {
|
||||||
reactive,
|
reactive,
|
||||||
ref,
|
ref
|
||||||
toRef,
|
|
||||||
watch
|
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
|
import { getTbShopCouponInfo, addTbShopCoupon } from '@/http/yskApi/coupon.js'
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
value: [
|
value: [
|
||||||
{ name: "周一", },
|
{ name: "周一", },
|
||||||
@@ -95,15 +118,42 @@
|
|||||||
{ name: "周六", },
|
{ name: "周六", },
|
||||||
{ name: "周日", },
|
{ name: "周日", },
|
||||||
],
|
],
|
||||||
|
mode: "",
|
||||||
title: "",
|
title: "",
|
||||||
show: false,
|
show: false,
|
||||||
|
useTimeShow: false,
|
||||||
|
useTime: "",
|
||||||
|
dateType: "",
|
||||||
|
sueDateType: "",
|
||||||
})
|
})
|
||||||
const saveData = reactive({
|
const formData = reactive({
|
||||||
type: '1',
|
type: '1',
|
||||||
timeType: '1',
|
title: '',
|
||||||
num: '',
|
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 ) => {
|
let modalShow = ( type ) => {
|
||||||
if ( type == 1) {
|
if ( type == 1) {
|
||||||
pageData.title = "领取后0天后的0点0分生效";
|
pageData.title = "领取后0天后的0点0分生效";
|
||||||
@@ -113,9 +163,82 @@
|
|||||||
pageData.show = true;
|
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 = () => {
|
let save = () => {
|
||||||
console.log(saveData.type)
|
formData.userDays = formData.userDays.toString();
|
||||||
console.log(saveData.timeType)
|
let params = {
|
||||||
|
...formData
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
addTbShopCoupon(params).then((res) => {
|
||||||
|
// console.log(res)
|
||||||
|
go.back(1)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -150,6 +273,30 @@
|
|||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.date,.time{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #999999;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
view{
|
||||||
|
border: 1rpx solid #999;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border-radius: 10rpx
|
||||||
|
}
|
||||||
|
view:nth-child(1){
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
view:nth-child(2){
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.time{
|
||||||
|
view{
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.item:last-child{
|
.item:last-child{
|
||||||
|
|||||||
@@ -4,19 +4,19 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">商品兑换券名称</view>
|
<view class="lable">商品兑换券名称</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input placeholder="填写名称" border="none" clearable ></up-input>
|
<up-input v-model="formData.title" placeholder="填写名称" border="none" clearable ></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">使用门槛</view>
|
<view class="lable">使用门槛</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<view>满</view><input placeholder="填写金额" border="none"></input><view>元,可用</view>
|
<view>满</view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元,可用</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="lable">总发放数量</view>
|
<view class="lable">总发放数量</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<up-input v-model="saveData.num" placeholder="填写数量" border="none" clearable ></up-input>
|
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -28,7 +28,12 @@
|
|||||||
<view class="selectGoods" @tap="selectGoodsOpen">
|
<view class="selectGoods" @tap="selectGoodsOpen">
|
||||||
<view>
|
<view>
|
||||||
<view class="title">选择商品</view>
|
<view class="title">选择商品</view>
|
||||||
<view class="goodsName">选择指定商品</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>
|
</view>
|
||||||
<up-icon name="arrow-right" color="#9F9F9F" size="22"></up-icon>
|
<up-icon name="arrow-right" color="#9F9F9F" size="22"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
@@ -46,23 +51,31 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import go from '@/commons/utils/go.js'
|
||||||
import myActionSheet from '@/components/my-components/my-action-sheet';
|
import myActionSheet from '@/components/my-components/my-action-sheet';
|
||||||
import selectGoods from './components/select-goods';
|
import selectGoods from './components/select-goods';
|
||||||
import {
|
import { getTbShopCouponInfo, addTbShopCoupon } from '@/http/yskApi/coupon.js'
|
||||||
reactive,
|
import { reactive, ref } from 'vue';
|
||||||
ref,
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
toRef,
|
|
||||||
watch
|
|
||||||
} from 'vue';
|
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
|
id: null,
|
||||||
|
goodsData: null,
|
||||||
title: "",
|
title: "",
|
||||||
show: false,
|
show: false,
|
||||||
})
|
})
|
||||||
const saveData = reactive({
|
let formData = reactive({
|
||||||
type: '1',
|
title: "",
|
||||||
timeType: '1',
|
type: '2',
|
||||||
num: '',
|
fullAmount: null,
|
||||||
|
number: null,
|
||||||
|
products: []
|
||||||
|
})
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if ( options.type == 'info' ) {
|
||||||
|
pageData.id = options.id;
|
||||||
|
getConponInfo();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let goods = ref(null)
|
let goods = ref(null)
|
||||||
@@ -70,12 +83,38 @@
|
|||||||
goods.value.open();
|
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 save = () => {
|
||||||
console.log(saveData.type)
|
let params = {
|
||||||
console.log(saveData.timeType)
|
...formData
|
||||||
|
}
|
||||||
|
addTbShopCoupon(params).then((res) => {
|
||||||
|
go.back(1)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -129,6 +168,13 @@
|
|||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
.goodsItem{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.productName{
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 顶部菜单 -->
|
<!-- 顶部菜单 -->
|
||||||
<view class="tagClass">
|
<view class="tagClass">
|
||||||
<view class="tag-item" @tap="tagClick(item,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">
|
v-for="(item,index) in pageData.status.list" :key="index">
|
||||||
{{item}}(0)
|
{{item.name}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 搜搜 -->
|
<!-- 搜搜 -->
|
||||||
<view class="search">
|
<!-- <view class="search">
|
||||||
<!-- <view class="inputsearch">
|
|
||||||
搜索优惠券名称
|
|
||||||
</view> -->
|
|
||||||
<up-input
|
<up-input
|
||||||
placeholder="搜索优惠券名称"
|
placeholder="搜索优惠券名称"
|
||||||
prefixIcon="search"
|
prefixIcon="search"
|
||||||
@@ -23,27 +20,27 @@
|
|||||||
<view class="searchBtn">
|
<view class="searchBtn">
|
||||||
搜索
|
搜索
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<!-- 内容 -->
|
<!-- 内容 -->
|
||||||
<view class="couponContentList">
|
<view class="couponContentList">
|
||||||
<view class="couponContent" v-for="(item,index) in 4" :key="index">
|
<view class="couponContent" v-for="(item,index) in pageData.couponList" :key="index">
|
||||||
|
|
||||||
<view class="couponContentListTop">
|
<view class="couponContentListTop">
|
||||||
<view class="title"> 充值20元优惠券 </view>
|
<view class="title"> {{ item.title }} </view>
|
||||||
<view> ID:258792 </view>
|
<view> ID:{{item.id}} </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="couponContentListcontent">
|
<view class="couponContentListcontent">
|
||||||
<view>
|
<view>
|
||||||
<view> 使用门槛 </view>
|
<view> 使用门槛 </view>
|
||||||
<view> 满200.00元减20.00元 </view>
|
<view> 满 {{ item.fullAmount }} 元减 {{ item.discountAmount }} 元 </view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 领取方式 </view>
|
<view> 领取方式 </view>
|
||||||
<view> 店铺领取可用 </view>
|
<view> 用户不可自行领取 </view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 有效期 </view>
|
<view> 有效期 </view>
|
||||||
<view> 满200.00元减20.00元 </view>
|
<view> 领券后{{ item.validDays }}天过期 </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="JQclass">
|
<view class="JQclass">
|
||||||
<image :src="'/static/coupon/qrcode.svg'" mode="scaleToFill" />
|
<image :src="'/static/coupon/qrcode.svg'" mode="scaleToFill" />
|
||||||
@@ -51,27 +48,31 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="couponContentListcontent2">
|
<view class="couponContentListcontent2">
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="num"> 1000 </view>
|
<view class="num"> {{ item.number }} </view>
|
||||||
<view class="lable"> 发放数量 </view>
|
<view class="lable"> 发放数量 </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="num"> 0 </view>
|
<view class="num"> {{ item.number-item.leftNumber }} </view>
|
||||||
<view class="lable"> 发放数量 </view>
|
<view class="lable"> 已领取 </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="num"> 1000 </view>
|
<view class="num"> {{ item.leftNumber }} </view>
|
||||||
<view class="lable"> 发放数量 </view>
|
<view class="lable"> 剩余 </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="num"> 0 </view>
|
<view class="num"> {{ item.useNumber }} </view>
|
||||||
<view class="lable"> 发放数量 </view>
|
<view class="lable"> 已使用 </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="couponContentListbottom">
|
<view class="couponContentListbottom">
|
||||||
<button @tap="editCoupon(item)">编辑</button>
|
<button @tap="editCoupon(item)">编辑</button>
|
||||||
<button>删除</button>
|
<button @tap="delCoupon(item)">删除</button>
|
||||||
</view>
|
</view>
|
||||||
</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>
|
||||||
|
|
||||||
|
|
||||||
@@ -82,50 +83,99 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
|
import { getTbShopCoupon , delTbShopCoupon} from '@/http/yskApi/coupon.js'
|
||||||
import {
|
import {
|
||||||
reactive,
|
reactive,
|
||||||
ref,
|
ref,
|
||||||
toRef,
|
onMounted
|
||||||
watch
|
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
import { onLoad, onShow,onPageScroll,
|
||||||
|
onPullDownRefresh,
|
||||||
|
onReachBottom, } from '@dcloudio/uni-app';
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
status: {
|
status: {
|
||||||
list: ['优惠券', '商品兑换券', ],
|
list: [
|
||||||
|
{name: '优惠券', type: 1},
|
||||||
|
{name: '商品兑换券', type: 2},
|
||||||
|
],
|
||||||
tagName: "优惠券",
|
tagName: "优惠券",
|
||||||
active: 0,
|
active: 0,
|
||||||
}
|
},
|
||||||
|
query: {
|
||||||
|
type: 1,
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
couponList: [],
|
||||||
|
totalElements: 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getCoupon();
|
||||||
|
})
|
||||||
|
|
||||||
|
onReachBottom(() => {
|
||||||
|
// pageData.query.page++
|
||||||
|
// getCoupon()
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tag切换
|
* tag切换
|
||||||
*/
|
*/
|
||||||
let tagClick = ( name,index ) => {
|
let tagClick = ( item ) => {
|
||||||
pageData.status.active = index;
|
pageData.query.type = item.type;
|
||||||
pageData.status.tagName = name;
|
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 = ()=>{
|
let addCoupon = ()=>{
|
||||||
if ( pageData.status.active == 0 ) {
|
if ( pageData.query.type == 1 ) {
|
||||||
go.to('PAGES_COUPON_DISCOUNTCOUPONS')
|
go.to('PAGES_COUPON_DISCOUNTCOUPONS')
|
||||||
} else {
|
} else {
|
||||||
go.to('PAGES_COUPON_CERTIFICATE')
|
go.to('PAGES_COUPON_CERTIFICATE')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 修改
|
||||||
*/
|
*/
|
||||||
let editCoupon = ()=>{
|
let editCoupon = (item)=>{
|
||||||
if ( pageData.status.active == 0 ) {
|
console.log(item.id)
|
||||||
go.to('PAGES_COUPON_DISCOUNTCOUPONS')
|
if ( item.type == 1 ) {
|
||||||
|
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', id: item.id})
|
||||||
} else {
|
} else {
|
||||||
go.to('PAGES_COUPON_CERTIFICATE')
|
go.to('PAGES_COUPON_CERTIFICATE',{type: 'info', id: item.id})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
let delCoupon = (item) => {
|
||||||
|
delTbShopCoupon([item.id]).then((res) => {
|
||||||
|
getCoupon();
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
@@ -138,7 +188,7 @@
|
|||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
padding-top: 44rpx;
|
padding-top: 44rpx;
|
||||||
padding: 0 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
.tag-item {
|
.tag-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -192,9 +242,9 @@
|
|||||||
.couponContentList {
|
.couponContentList {
|
||||||
/* width: 694rpx; */
|
/* width: 694rpx; */
|
||||||
/* height: 544rpx; */
|
/* height: 544rpx; */
|
||||||
margin: 0 auto;
|
margin: 32rpx auto 0;
|
||||||
margin-bottom: 32rpx;
|
margin-bottom: 32rpx;
|
||||||
padding: 0 28rpx 32rpx 28rpx;
|
padding: 0 28rpx 182rpx 28rpx;
|
||||||
}
|
}
|
||||||
.couponContent {
|
.couponContent {
|
||||||
/* background-color: #f9f9f9; */
|
/* background-color: #f9f9f9; */
|
||||||
@@ -315,7 +365,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.couponContent:last-of-type{
|
.couponContent:last-of-type{
|
||||||
margin-bottom: 150rpx;
|
/* margin-bottom: 150rpx; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottomPop {
|
.bottomPop {
|
||||||
|
|||||||
Reference in New Issue
Block a user