feat:商家活动
This commit is contained in:
1 parent
f075a42ff1
commit
02af9347d2
7 files changed
+216
-32
No files matched your search
@@ -118,6 +118,20 @@
|
||||
"navigationBarTitleText": "商户品牌详情",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "merchant-activity",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商户活动",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "coupon-list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "优惠券列表",
|
||||
"disableScroll": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
|
||||
<template #main-top>
|
||||
<view class="bg-white rounded-16rpx px-20rpx my-20rpx">
|
||||
<z-tabs :list="tabs" @change="doTab" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="card w-full h-400rpx relative activity-card overflow-hidden">
|
||||
<view class="ribbon">兑换券</view>
|
||||
<view class="px-10 py-4 flex justify-between font-bold">
|
||||
<text class="text-32 c-#FFD941">限时领取</text>
|
||||
<text class="text-32 c-#FFD941 px-1 rounded-full bg-#FFD94133">2025-09-21</text>
|
||||
</view>
|
||||
<view class="w-2/3 px-10 text-32 c-#fff font-bold">店内消费额外支付1元可领取衣服一件</view>
|
||||
<view class="absolute bottom-60 left-80 text-28 bg-#eeeeee44 c-#fff px-2 rounded-full">限量领取 先到先得</view>
|
||||
</view>
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { actCancel } from "@/sheep/api"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { reactive, ref } from "vue"
|
||||
|
||||
const tabs = [
|
||||
{ id: null, name: "全部", disabled: false },
|
||||
{ id: 1, name: "未核销", disabled: false },
|
||||
{ id: 1, name: "已核销", disabled: false },
|
||||
]
|
||||
const params = reactive({
|
||||
actStatus: tabs[0].id,
|
||||
})
|
||||
const couponList = ref([])
|
||||
|
||||
onLoad(() => {
|
||||
getCouponList()
|
||||
})
|
||||
|
||||
const doTab = (e: any) => {
|
||||
params.actStatus = tabs[e].id
|
||||
getCouponList()
|
||||
}
|
||||
|
||||
// 商家查看优惠券列表
|
||||
const getCouponList = async () => {
|
||||
const { code, data, msg }: any = await actCancel.appMchPage(params)
|
||||
if (code != 0) return uni.showToast({ title: msg || "列表获取失败", icon: "none" })
|
||||
couponList.value = data ?? []
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.activity-card {
|
||||
background-image: url("../../static/page/activity-card-bg.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
background-position: 150%;
|
||||
background-color: #1879ff77;
|
||||
}
|
||||
.ribbon {
|
||||
width: 160rpx;
|
||||
height: 40rpx;
|
||||
background: #dd0d1f;
|
||||
position: absolute;
|
||||
left: -40rpx;
|
||||
top: 20rpx;
|
||||
transform: rotateZ(-45deg);
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
|
||||
<view class="px-2 py-4">
|
||||
<view class="card w-full h-400rpx relative activity-card overflow-hidden">
|
||||
<view class="ribbon">兑换券</view>
|
||||
<view class="px-10 py-4 flex justify-between font-bold">
|
||||
<text class="text-32 c-#FFD941">限时领取</text>
|
||||
<text class="text-32 c-#FFD941 px-1 rounded-full bg-#FFD94133">2025-09-21</text>
|
||||
</view>
|
||||
<view class="w-2/3 px-10 text-32 c-#fff font-bold">店内消费额外支付1元可领取衣服一件</view>
|
||||
<view class="absolute bottom-60 left-80 text-28 bg-#eeeeee44 c-#fff px-2 rounded-full">限量领取 先到先得</view>
|
||||
</view>
|
||||
<view v-if="isGet" class="text-center card p-3 sub-text-30">已 领 取</view>
|
||||
<view v-else class="text-center card p-3 sub-text-30" @click="doGetCoupon">立 即 领 取</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed bottom-80rpx left-40rpx">
|
||||
<tm-button class="px-2" size="m" :linear="['to right', '#0779FD', '#62abff']" @click="getActivityQrcode">去支付</tm-button>
|
||||
</view>
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { actCancel } from "@/sheep/api"
|
||||
import { ref } from "vue"
|
||||
|
||||
const isGet = ref(false)
|
||||
|
||||
// 立即领取
|
||||
const doGetCoupon = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: "正在领取..." })
|
||||
const { code, msg }: any = await actCancel.appGet({})
|
||||
if (code != 0) {
|
||||
isGet.value = true
|
||||
return uni.showToast({ title: msg || "领取失败", icon: "none" })
|
||||
}
|
||||
uni.showToast({ title: "领取成功", icon: "success" })
|
||||
isGet.value = true
|
||||
} catch (error: any) {
|
||||
uni.showToast({ title: "领取失败", icon: "none" })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// 去支付
|
||||
const getActivityQrcode = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: "加载中...", mask: true })
|
||||
const { code, data, msg }: any = await actCancel.appFindUnique()
|
||||
if (code != 0) return uni.showToast({ title: msg || "你还未领取兑换券", icon: "none" })
|
||||
uni.navigateTo({ url: `/pages/pay/scanPay?actId=${data.actId}` })
|
||||
} catch (error) {
|
||||
uni.showToast({ title: "加载失败", icon: "none" })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.activity-card {
|
||||
background-image: url("../../static/page/activity-card-bg.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
background-position: 150%;
|
||||
background-color: #1879ff77;
|
||||
}
|
||||
.ribbon {
|
||||
width: 160rpx;
|
||||
height: 40rpx;
|
||||
background: #dd0d1f;
|
||||
position: absolute;
|
||||
left: -40rpx;
|
||||
top: 20rpx;
|
||||
transform: rotateZ(-45deg);
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<tm-button class="mt-1" :block="true" @click="handlePay()" :disabled="loading">支 付</tm-button>
|
||||
|
||||
<number-keyboard v-if="!scanPayState.action" v-model="amount" />
|
||||
<number-keyboard v-if="numberKeyboardShow" v-model="amount" />
|
||||
</view>
|
||||
</crud-layout>
|
||||
</template>
|
||||
@@ -59,6 +59,7 @@ const walletList = ref<any>([]) // 钱包列表
|
||||
const selectWallet = ref<any>({}) // 当前选中的钱包
|
||||
const orderInfo = ref<any>({}) // 订单信息
|
||||
const amount = ref("") // 键盘输入的金额
|
||||
const numberKeyboardShow = ref(true)
|
||||
|
||||
onLoad(async (options: any) => {
|
||||
uni.showLoading({ title: "加载中..." })
|
||||
@@ -68,6 +69,7 @@ onLoad(async (options: any) => {
|
||||
scanPayState.mchId = mchId
|
||||
scanPayState.orderId = orderId
|
||||
scanPayState.action = action
|
||||
numberKeyboardShow.value = false
|
||||
await getMchDetail(mchId)
|
||||
await getOrderInfo()
|
||||
const order = orderInfo.value
|
||||
@@ -75,6 +77,14 @@ onLoad(async (options: any) => {
|
||||
return
|
||||
}
|
||||
|
||||
const { actId } = options
|
||||
if (!isEmpty(actId)) {
|
||||
amount.value = "1.00"
|
||||
scanPayState.mchName = "活动支付"
|
||||
numberKeyboardShow.value = false
|
||||
return
|
||||
}
|
||||
|
||||
const { id } = options
|
||||
if (!isEmpty(id)) {
|
||||
scanPayState.mchId = id
|
||||
|
||||
@@ -326,6 +326,7 @@ onLoad(async () => {
|
||||
await userApi.userRole()
|
||||
|
||||
await isMallMchUser()
|
||||
await isMchUser()
|
||||
|
||||
// 获取存储中的用户信息
|
||||
storage.getUserInfo()
|
||||
@@ -336,6 +337,11 @@ const isMallMchUser = async () => {
|
||||
if (data)
|
||||
state.menuList.unshift({ text: "共富商城商品管理", icon: "/static/icon/service_4.png", path: "/pages/prosperity-shop/goods-manage" })
|
||||
}
|
||||
const isMchUser = async () => {
|
||||
const { data } = await userApi.isMerchant()
|
||||
// 商家查看优惠券列表
|
||||
if (data) state.menuList.unshift({ text: "优惠券列表", icon: "/static/icon/service_1.png", path: "/pages/merchant/coupon-list" })
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
// 获取存储中的用户信息
|
||||
|
||||
+30
-31
@@ -1,34 +1,33 @@
|
||||
import request from "@/sheep/utils/request"
|
||||
|
||||
export default {
|
||||
/**
|
||||
* app领取优惠券
|
||||
* 不用穿参数
|
||||
*/
|
||||
appGet: (data: any) =>
|
||||
request({
|
||||
url: "/act/cancel-item/app/get",
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
/**
|
||||
* app查询用户的唯一优惠券
|
||||
* 不用穿参数
|
||||
*/
|
||||
appFindUnique: (params: any) =>
|
||||
request({
|
||||
url: "/act/cancel-item/app/find-unique",
|
||||
method: "GET",
|
||||
params,
|
||||
}),
|
||||
/**
|
||||
* app查询本店优惠券列表
|
||||
* @param params.actStatus 核销类型
|
||||
*/
|
||||
appMchPage: (params: any) =>
|
||||
request({
|
||||
url: "/act/cancel-item/app/mch/page",
|
||||
method: "GET",
|
||||
params,
|
||||
}),
|
||||
}
|
||||
/**
|
||||
* app领取优惠券
|
||||
* 不用传参数
|
||||
*/
|
||||
appGet: (data: any) =>
|
||||
request({
|
||||
url: "/wallet/act/cancel-item/app/get",
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
/**
|
||||
* app查询用户的唯一优惠券
|
||||
* 不用传参数
|
||||
*/
|
||||
appFindUnique: () =>
|
||||
request({
|
||||
url: "/wallet/act/cancel-item/app/find-unique",
|
||||
method: "GET",
|
||||
}),
|
||||
/**
|
||||
* app查询本店优惠券列表
|
||||
* @param params.actStatus 核销类型
|
||||
*/
|
||||
appMchPage: (params: any) =>
|
||||
request({
|
||||
url: "/wallet/act/cancel-item/app/mch/page",
|
||||
method: "GET",
|
||||
params,
|
||||
}),
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Reference in new issue
Block a user