diff --git a/common/api/member.js b/common/api/member.js
index 9074f90..44101b9 100644
--- a/common/api/member.js
+++ b/common/api/member.js
@@ -112,4 +112,31 @@ export const APIshopUsercode = (data) => {
method: 'get',
data: data
})
+}
+
+// 获取当前店铺会员信息
+export const getCouponShops = (data) => {
+ return request({
+ url: urlMarket + '/user/coupon/shops',
+ method: 'get',
+ data: data
+ })
+}
+
+// 优惠券弹窗
+export const getCouponPopup = (data) => {
+ return request({
+ url: urlMarket + '/user/coupon/popUp',
+ method: 'get',
+ data: data
+ })
+}
+
+// 优惠券弹窗领取
+export const receivePopUp = (data) => {
+ return request({
+ url: urlMarket + '/user/coupon/receivePopUp',
+ method: 'get',
+ data: data
+ })
}
\ No newline at end of file
diff --git a/components/coupon-modal.vue b/components/coupon-modal.vue
new file mode 100644
index 0000000..06bfde7
--- /dev/null
+++ b/components/coupon-modal.vue
@@ -0,0 +1,328 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ¥{{ val.discountAmount }}
+ 满{{ val.fullAmount }}可用
+
+
+ 商品兑换{{ val.discountNum }}件
+ 满{{ val.fullAmount }}可用
+
+
+ {{ val.discountRate }}折券
+ 满{{ val.fullAmount }}可用
+
+
+ 第二件半价券
+ 满{{ val.fullAmount }}可用
+
+
+ 买一送一券
+ 满{{ val.fullAmount }}可用
+
+
+ {{ val.title }}
+
+
+
+
+ 有效期至:{{ dayjs(val.validStartTime).format('YYYY.M.D') }}-{{ dayjs(val.validEndTime).format('YYYY.M.D') }}
+
+
+
+
+
+
+ 立即
+ 领取
+
+
+
+
+
+
+
+
+
+
+
+ {{ item }}
+
+
+
+
+
+
+
+
+ 全部领取({{ couponCount }}张)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index 8527ebd..1f364de 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,10 @@
{
- "dependencies": {
- "@dcloudio/uni-app": "^2.0.2-4040520250103001",
- "dayjs": "^1.11.13",
- "jsbarcode": "^3.11.6",
- "pinia": "^2.3.1",
- "pinia-plugin-unistorage": "^0.1.2"
- }
-}
\ No newline at end of file
+ "dependencies": {
+ "@dcloudio/uni-app": "^2.0.2-4040520250103001",
+ "dayjs": "^1.11.13",
+ "jsbarcode": "^3.11.6",
+ "lodash": "^4.17.21",
+ "pinia": "^2.3.1",
+ "pinia-plugin-unistorage": "^0.1.2"
+ }
+}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 83b3903..5af1803 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -3,14 +3,13 @@
-
+
-
-
+
-
+
-
+
-
-
+
+
\ No newline at end of file
+}
+
diff --git a/pages/product/index.vue b/pages/product/index.vue
index ec7ea40..b41b4df 100644
--- a/pages/product/index.vue
+++ b/pages/product/index.vue
@@ -2,11 +2,12 @@
-
-
-
+
+
@@ -18,55 +19,51 @@
-
- 距离您{{ distance }}
-
+ 距离您{{ distance }}
- 营业时间:{{ (shopInfo.businessStartDay || '--') +' 至 '+ (shopInfo.businessEndDay || '--')}}
- {{endTimeref.startTime}} -
- {{endTimeref.endTime < '05'?` 凌晨${endTimeref.endTime}`:endTimeref.endTime}}
+ 营业时间:{{ (shopInfo.businessStartDay || '--') + ' 至 ' + (shopInfo.businessEndDay || '--') }} {{ endTimeref.startTime }} -
+ {{ endTimeref.endTime < '05' ? ` 凌晨${endTimeref.endTime}` : endTimeref.endTime }}
- 查看
+ 查看
-
- 本店招牌菜
-
-
-
+ 本店招牌菜
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
{{ item.name }}
-
- 本店回头客第{{index+1}}名
-
+ 本店回头客第{{ index + 1 }}名
招牌
-
- 「{{item.suitNum}}{{item.unitName}}起点」
+
+ 「{{ item.suitNum }}{{ item.unitName }}起点」
@@ -76,39 +73,39 @@
月售{{item.stockNumber}}
-->
-
+
- ¥
+ ¥
- {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}
+ {{ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? item.memberPrice || item.salePrice : item.salePrice }}
- /{{item.unitName}}
+ /{{ item.unitName }}
-
- 未开售
+
+ 未开售
已售罄
-
+
- ¥
+ ¥
- {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice|| item.salePrice):item.salePrice}}
+ {{ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? item.memberPrice || item.salePrice : item.salePrice }}
- /{{item.unitName}}
+ /{{ item.unitName }}
@@ -116,27 +113,24 @@
-
+ @click.stop="clickspecifications(item, index, index1)"
+ >
选择套餐
选规格
- {{ ifcartNumber(item) <99?ifcartNumber(item):'99+'}}
+ {{ ifcartNumber(item) < 99 ? ifcartNumber(item) : '99+' }}
- singleclick(item, '-'), 500)">
-
+ singleclick(item, '-'), 500)">
- {{ ifcartNumber(item) }}
+ {{ ifcartNumber(item) }}
- singleclick(item, '+'), 500)">
-
+ singleclick(item, '+'), 500)">
@@ -148,152 +142,176 @@
-
+
-
-
- {{item.name}}
+
+
+
+ {{ item.name }}
+
-
+
- {{item.name}}
+ {{ item.name }}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- TOP{{index1+1}}
-
+ TOP{{ index1 + 1 }}
+
{{ item1.name }}
热销
- {{item1.shortTitle?item1.shortTitle:''}}
+ {{ item1.shortTitle ? item1.shortTitle : '' }}
-
- 「{{item1.suitNum}}{{item1.unitName}}起点」
+
+ 「{{ item1.suitNum }}{{ item1.unitName }}起点」
-
+
¥
-
- {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1 ?(item1.memberPrice||item1.salePrice):item1.salePrice}}
+
+ {{ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? item1.memberPrice || item1.salePrice : item1.salePrice }}
- /{{item1.unitName}}
+ /{{ item1.unitName }}
-
- 未开售
+
+ 未开售
已售罄
-
+
¥
- {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item1.memberPrice||item1.salePrice):item1.salePrice}}
+ {{ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? item1.memberPrice || item1.salePrice : item1.salePrice }}
- /{{item1.unitName}}
+ /{{ item1.unitName }}
-
-
+
+
选择套餐
选规格
- {{ ifcartNumber(item1) <99?ifcartNumber(item1):'99+'}}
+ {{ ifcartNumber(item1) < 99 ? ifcartNumber(item1) : '99+' }}
-
+
- singleclick(item1, '-'), 500)">
-
+ singleclick(item1, '-'), 500)">
- {{ ifcartNumber(item1) }}
+ {{ ifcartNumber(item1) }}
- singleclick(item1, '+'), 500)">
-
+ singleclick(item1, '+'), 500)">
-
+
-
-
-
-
+
-
-
+
-
-
- {{cartLists_count<99?cartLists_count:'99+'}}
+ mode="aspectFill"
+ @click="Historicalorders(true)"
+ >
+ {{ cartLists_count < 99 ? cartLists_count : '99+' }}
¥
- {{totalPrices}}
+ {{ totalPrices }}
结算
@@ -302,35 +320,46 @@
-
+
-
+
-
+
- {{specifications.item.name}}
+ {{ specifications.item.name }}
- {{specifications.item.shortTitle?specifications.item.shortTitle:''}}
+ {{ specifications.item.shortTitle ? specifications.item.shortTitle : '' }}
-
+
- {{specType }}
+ {{ specType }}
-
- {{option}}
-
+ :class="{ shop_sku_box_item_selected: selectedSpecs[specType] === option }"
+ >
+ {{ option }}
+
售罄
-
+
已下架
@@ -340,17 +369,19 @@
-
-
- {{setmenu.title}} {{setmenu.count }} 选{{setmenu.number }}
-
+
+ {{ setmenu.title }} {{ setmenu.count }} 选{{ setmenu.number }}
-
- {{option.proName}}
- /{{option.unitName}}
+
+ {{ option.proName }}
+ /{{ option.unitName }}
售罄
@@ -362,984 +393,939 @@
-
¥
- {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.result.memberPrice||specifications.item.result.salePrice):specifications.item.result.salePrice}}
- /{{specifications.item.unitName}}
-
- 「{{specifications.item.result.suitNum}}{{specifications.item.result.unitName}}起点」
+
+ {{
+ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
+ ? specifications.item.result.memberPrice || specifications.item.result.salePrice
+ : specifications.item.result.salePrice
+ }}
+ /{{ specifications.item.unitName }}
+ 「{{ specifications.item.result.suitNum }}{{ specifications.item.result.unitName }}起点」
¥
- {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.memberPrice||specifications.item.salePrice):specifications.item.salePrice}}
-
-
- /{{specifications.item.unitName}}
-
-
- 「{{specifications.item.suitNum}}{{specifications.item.unitName}}起点」
+ {{
+ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
+ ? specifications.item.memberPrice || specifications.item.salePrice
+ : specifications.item.salePrice
+ }}
+ /{{ specifications.item.unitName }}
+ 「{{ specifications.item.suitNum }}{{ specifications.item.unitName }}起点」
-
-
-
+
+
{{ shopCartNumber }}
-
-
+
- {{selectedSpecsStr }}
+ {{ selectedSpecsStr }}
-
- {{skuBtnText}}
+
+ {{ skuBtnText }}
-
- {{skuBtnText}}
+
+ {{ skuBtnText }}
-
+
已下单菜品
+
\ No newline at end of file
+}
+
diff --git a/pages/user/components/coupon-icon.vue b/pages/user/components/coupon-icon.vue
new file mode 100644
index 0000000..7859901
--- /dev/null
+++ b/pages/user/components/coupon-icon.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+ ¥
+ {{ props.item.discountAmount }}
+
+
+ 满{{ props.item.fullAmount }}可用
+
+
+
+
+ {{ props.item.discountNum }}件
+ 商品兑换
+
+
+ 满{{ props.item.fullAmount }}可用
+
+
+
+
+ {{ props.item.discountRate }}折
+
+
+ 满{{ props.item.fullAmount }}可用
+
+
+
+
+ 第二件
+ 半价券
+
+
+
+
+ 买一送
+ 一券
+
+
+
+
+
+
+
+
diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue
index fb2824f..9cfbbaf 100644
--- a/pages/user/coupon.vue
+++ b/pages/user/coupon.vue
@@ -12,7 +12,7 @@
-
+
@@ -30,23 +30,26 @@
-
+
+
+
{{ item.name }}
- {{ dayjs(item.effectStartTime).format('YYYY.MM.DD') }} - {{ dayjs(item.effectEndTime).format('YYYY.MM.DD') }}
+ {{ dayjs(item.effectStartTime).format('YYYY.M.D') }} - {{ dayjs(item.effectEndTime).format('YYYY.M.D') }}
-
+
去使用
+
+ {{ statusList.find((val) => val.value == item.status).label }}
+
-
- 1、可适用门店:{{ item.useShops }} 2、可适用商品:{{ item.foods }}3、可使用类型:{{ convertValuesToLabels(item.useType) }}
-
+ 1、可适用门店:{{ item.useShops }} 2、可适用商品:{{ item.foods }}3、可使用类型:{{ convertValuesToLabels(item.useType) }}
查看详情
@@ -59,18 +62,10 @@
店铺列表
-
@@ -107,13 +90,15 @@
import dayjs from 'dayjs';
import { ref, reactive, onMounted } from 'vue';
import { onLoad, onReady, onShow, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
-import { APIcouponfindByUserId, APIfindCoupon } from '@/common/api/member.js';
+import { APIcouponfindByUserId, APIfindCoupon, getCouponShops } from '@/common/api/member.js';
+import couponIcon from './components/coupon-icon.vue';
const show = ref(false);
const querForm = ref({
searchValue: '',
shopId: '',
+ shopName: '',
statusActiveIndex: 0
});
@@ -142,26 +127,46 @@ const statusList = ref([
const list = reactive({
page: 1,
size: 10,
- status: 'nomore',
+ status: 'loading',
data: []
});
onReachBottom(() => {
- console.log('到底了');
- list.page++;
- getCouponList();
+ if (list.status != 'nomore') {
+ list.page++;
+ getCouponList();
+ }
});
const showDetail = ref(false);
const selectListItem = ref('');
+const selectListItemDetails = ref([]);
function showDetailHandle(item) {
showDetail.value = true;
- selectListItem.value = item;
+ selectListItemDetails.value = [
+ `可适用门店:${item.useShops}`,
+ `可适用商品:${item.foods}`,
+ `可使用类型:${convertValuesToLabels(item.useType)}`,
+ `可用时间段:${item.useTimeType == 'all' ? '全段时间可用' : `${item.useStartTime} - ${item.useEndTime}`}`,
+ `限量规则:${item.getLimit == -10086 ? '无限' : `${item.getLimit}张`}`,
+ `同享规则:${item.vipPriceShare ? '与限时折扣同享、与会员价同享' : '不与限时折扣同享、与会员价同享'}`,
+ `其它说明:${item.ruleDetails || '无'}`
+ ];
+
+ if (item.type == 2 || item.type == 4) {
+ selectListItemDetails.value.splice(2, 0, `使用规则:${item.useRule == 'price_asc' ? '从最低价开始抵扣' : '从最高价开始抵扣'}`);
+ }
+
+ if (item.type == 3) {
+ selectListItemDetails.value.unshift(`最高抵扣${item.maxDiscountAmount}元`);
+ // selectListItemDetails.value.splice(3, 0, `使用规则:${item.useRule == 'price_asc' ? '从最低价开始抵扣' : '从最高价开始抵扣'}`);
+ }
}
// 搜索
function searchHandle() {
list.page = 1;
+ list.status = 'loading';
getCouponList();
}
@@ -169,9 +174,19 @@ function searchHandle() {
function tabChange(index) {
querForm.value.statusActiveIndex = index;
list.page = 1;
+ list.status = 'loading';
getCouponList();
}
+// 去使用
+function toUseHandle(item) {
+ console.log(item);
+ uni.cache.set('shopId', item.shopId);
+ uni.switchTab({
+ url: '/pages/index/index'
+ });
+}
+
// 获取优惠券列表
async function getCouponList() {
try {
@@ -192,12 +207,21 @@ async function getCouponList() {
} else {
list.data.push(...res.records);
}
+
+ if (res.pageNumber == res.totalPage || res.records.length == 0) {
+ list.status = 'nomore';
+ }
} catch (error) {
console.log(error);
}
uni.hideLoading();
}
+// 店铺列表滚动到底部了
+function scrollBottom() {
+ console.log('店铺列表滚动到底部了');
+}
+
/**
* 将value数组字符串转换为对应的label拼接字符串
* @param {Array} options - 包含value和label的选项数组,格式如[{value: 'xxx', label: 'xxx'}, ...]
@@ -258,9 +282,32 @@ function convertValuesToLabels(valueStr, options, separator = '、') {
}
}
+// 选择店铺
+function selectShopHandle(item) {
+ querForm.value.shopId = item.shopId;
+ querForm.value.shopName = item.shopName;
+ list.page = 1;
+ show.value = false;
+ getCouponList();
+}
+// 获取当前店铺会员信息
+const shopList = ref([]);
+async function getCouponShopsAjax() {
+ try {
+ const res = await getCouponShops();
+ shopList.value = res;
+ } catch (error) {
+ console.log(error);
+ }
+}
+
onShow(() => {
getCouponList();
});
+
+onLoad(() => {
+ getCouponShopsAjax();
+});