From 79b258243a7a27d1fb1a8cfa1f611ee8fa86d601 Mon Sep 17 00:00:00 2001
From: GaoHao <1210693421@qq.com>
Date: Sat, 26 Oct 2024 16:17:34 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=98=E6=83=A0=E5=88=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../my-components/my-date-pickerview.vue | 2 +-
http/yskApi/coupon.js | 58 +++++
http/yskApi/http.js | 4 +-
pageCoupon/components/select-goods.vue | 25 +--
pageCoupon/discountCoupons.vue | 199 +++++++++++++++---
pageCoupon/editCertificate.vue | 80 +++++--
pageCoupon/index.vue | 128 +++++++----
7 files changed, 396 insertions(+), 100 deletions(-)
create mode 100644 http/yskApi/coupon.js
diff --git a/components/my-components/my-date-pickerview.vue b/components/my-components/my-date-pickerview.vue
index c061e1f..0f92a6f 100644
--- a/components/my-components/my-date-pickerview.vue
+++ b/components/my-components/my-date-pickerview.vue
@@ -129,7 +129,7 @@
mode: {
//all date time
type: String,
- default: 'all'
+ default: 'time'
},
yearsLen:{
type: Number,
diff --git a/http/yskApi/coupon.js b/http/yskApi/coupon.js
new file mode 100644
index 0000000..ae4d4fc
--- /dev/null
+++ b/http/yskApi/coupon.js
@@ -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
+ })
+}
diff --git a/http/yskApi/http.js b/http/yskApi/http.js
index db1a980..cfb63d3 100644
--- a/http/yskApi/http.js
+++ b/http/yskApi/http.js
@@ -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'
diff --git a/pageCoupon/components/select-goods.vue b/pageCoupon/components/select-goods.vue
index feab79a..2bda69c 100644
--- a/pageCoupon/components/select-goods.vue
+++ b/pageCoupon/components/select-goods.vue
@@ -3,7 +3,7 @@
请选择
-
+
@@ -65,7 +65,7 @@ import {
goodsValue.value = item.id;
}
function groupChange ( n ) {
- console.log(n)
+ // console.log(n)
}
function getCategoryList () {
$tbShopCategory({
@@ -78,7 +78,6 @@ import {
}
function getGoodsList () {
$tbProductV2(category.query).then(res => {
- console.log(res);
category.goodsList = res.content.map(v => {
return {
...v,
@@ -104,18 +103,14 @@ import {
* 确认
*/
function affirm() {
- console.log(goodsValue.value)
- // let params = {
- // coverImg: vdata.imgUrlList,
- // consId: itemData.value.consId,
- // amount: vdata.stockNumber,
- // shopId: uni.getStorageSync("shopId"),
- // }
- // tbConsInfoFlowfrmLoss(params).then((res) => {
- // show.value = false;
- // vdata.imgUrlList = [];
- // vdata.stockNumber = 1;
- // })
+ let item;
+ category.goodsList.forEach((v,e)=>{
+ if ( v.id == goodsValue.value) {
+ item = v;
+ }
+ })
+ emits('affirm',item)
+ close();
}
defineExpose({
open,close,affirm
diff --git a/pageCoupon/discountCoupons.vue b/pageCoupon/discountCoupons.vue
index 6d7384c..a382ff5 100644
--- a/pageCoupon/discountCoupons.vue
+++ b/pageCoupon/discountCoupons.vue
@@ -4,42 +4,50 @@
优惠券名称
-
+
使用门槛
- 满元,减元
+ 满元,减元
有效期类型
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ {{ formData.validStartTime || '开始时间'}}--
+ {{ formData.validEndTime || '结束时间'}}
+
+
有效期(天)
-
+
隔天生效
- 隔天生效
+ 隔天生效
可用日期
-
+
指定时间段可用
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ {{ formData.useStartTime || '开始时间'}}--
+ {{ formData.useEndTime || '结束时间'}}
+
@@ -67,24 +82,32 @@
-
+
-
+
+
@@ -150,6 +273,30 @@
width: 150rpx;
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{
diff --git a/pageCoupon/editCertificate.vue b/pageCoupon/editCertificate.vue
index 651951e..aa2048b 100644
--- a/pageCoupon/editCertificate.vue
+++ b/pageCoupon/editCertificate.vue
@@ -4,19 +4,19 @@
商品兑换券名称
-
+
使用门槛
- 满元,可用
+ 满元,可用
总发放数量
-
+
@@ -28,7 +28,12 @@
选择商品
- 选择指定商品
+ 选择指定商品
+
+
+ {{item.name}}
+
+
@@ -46,23 +51,31 @@
@@ -129,6 +168,13 @@
font-size: 24rpx;
color: #999999;
}
+ .goodsItem{
+ display: flex;
+ align-items: center;
+ .productName{
+ margin-right: 20rpx;
+ }
+ }
}
}
}
diff --git a/pageCoupon/index.vue b/pageCoupon/index.vue
index 357d8b0..033d62c 100644
--- a/pageCoupon/index.vue
+++ b/pageCoupon/index.vue
@@ -1,16 +1,13 @@
-
- {{item}}(0)
+ {{item.name}}
-
-
+
-
+
- 充值20元优惠券
- ID:258792
+ {{ item.title }}
+ ID:{{item.id}}
使用门槛
- 满200.00元减20.00元
+ 满 {{ item.fullAmount }} 元减 {{ item.discountAmount }} 元
领取方式
- 店铺领取可用
+ 用户不可自行领取
有效期
- 满200.00元减20.00元
+ 领券后{{ item.validDays }}天过期
@@ -51,27 +48,31 @@
- 1000
+ {{ item.number }}
发放数量
- 0
- 发放数量
+ {{ item.number-item.leftNumber }}
+ 已领取
- 1000
- 发放数量
+ {{ item.leftNumber }}
+ 剩余
- 0
- 发放数量
+ {{ item.useNumber }}
+ 已使用
-
+
+
+
+
@@ -82,50 +83,99 @@