This commit is contained in:
2023-08-19 21:37:22 +08:00
parent 61f840059b
commit 8b5de95140
16 changed files with 749 additions and 518 deletions

View File

@@ -53,7 +53,6 @@
"@tarojs/shared": "3.6.11",
"@tarojs/taro": "3.6.11",
"pinia": "^2.1.6",
"uqrcodejs": "^4.0.7",
"vue": "^3.2.40"
},
"devDependencies": {

View File

@@ -2,3 +2,6 @@ import request from '../utils/request';
// 订单核销
export const orderVerify = (data: object) => request('/user/cancelPointOrder', data, 'POST');
// 活动订单核销
export const activeOrderVerify = (data: object) => request('/user/cancelOrder', data, 'POST');

View File

@@ -16,4 +16,13 @@ export const getGoodsDetail = (data: object) => request('/point/details', data,
export const createOrder = (data: object) => request('/point/place', data, 'POST')
// 确认付款
export const payJfOrder = (data: object) => request('/point/confirmOrder', data, 'POST')
export const payJfOrder = (data: object) => request('/point/confirmOrder', data, 'POST')
// 获取活动商品
export const getActiveGoods = () => request('/goods', {}, 'POST')
// 获取活动商品详情
export const getActiveGoodsDetail = (data: object) => request('/goods/details', data, 'POST')
// 活动商品下单
export const createActiveOrder = (data: object) => request('/order/place', data, 'POST')

View File

@@ -1,4 +1,4 @@
import request from '@/utils/request'
// 订单支付
export const payOrder = (data: object) => request('/order/place', data, 'POST')
export const payOrder = (data: object) => request('/order/confirmOrder', data, 'POST')

View File

@@ -1,86 +1,87 @@
export default defineAppConfig({
pages: [
'pages/index/index',
'pages/category/index',
'pages/cart/index',
'pages/user/index',
"pages/index/index",
"pages/category/index",
"pages/cart/index",
"pages/user/index",
],
subPackages: [
{
root: 'pages/users',
root: "pages/users",
pages: [
'order_list/index',
'setting/index',
'user_setting/index',
'settled_mer/index',
'order_list_detail/index',
'account/index'
]
"order_list/index",
"setting/index",
"user_setting/index",
"settled_mer/index",
"order_list_detail/index",
"account/index",
],
},
{
root: 'pages/goods',
root: "pages/goods",
pages: [
'goods_detail/index',
'order_create/index',
'order_status/index'
]
"goods_detail/index",
"order_create/index",
"order_status/index",
],
},
{
root: 'pages/admin',
pages: ['verify/index']
root: "pages/admin",
pages: ["verify/index"],
},
{
root: 'pages/game',
pages: [
'gamehome/index',
'gamedetail/index',
]
}
root: "pages/game",
pages: ["gamehome/index", "gamedetail/index", "gameview/index"],
},
{
root: "pages/hotGoods",
pages: ["index/index"],
},
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
backgroundTextStyle: "light",
navigationBarBackgroundColor: "#fff",
navigationBarTitleText: "WeChat",
navigationBarTextStyle: "black",
},
tabBar: {
color: '#666666',
selectedColor: '#ff0000',
backgroundColor: '#ffffff',
borderStyle: 'white',
color: "#666666",
selectedColor: "#ff0000",
backgroundColor: "#ffffff",
borderStyle: "white",
list: [
{
pagePath: 'pages/index/index',
iconPath: 'static/tabbar/1-001.png',
selectedIconPath: 'static/tabbar/1-002.png',
text: '首页'
pagePath: "pages/index/index",
iconPath: "static/tabbar/1-001.png",
selectedIconPath: "static/tabbar/1-002.png",
text: "首页",
},
{
pagePath: 'pages/category/index',
iconPath: 'static/tabbar/2-001.png',
selectedIconPath: 'static/tabbar/2-002.png',
text: '分类'
pagePath: "pages/category/index",
iconPath: "static/tabbar/2-001.png",
selectedIconPath: "static/tabbar/2-002.png",
text: "分类",
},
{
pagePath: 'pages/cart/index',
iconPath: 'static/tabbar/3-001.png',
selectedIconPath: 'static/tabbar/3-002.png',
text: '购物车'
pagePath: "pages/cart/index",
iconPath: "static/tabbar/3-001.png",
selectedIconPath: "static/tabbar/3-002.png",
text: "购物车",
},
{
pagePath: 'pages/user/index',
iconPath: 'static/tabbar/4-001.png',
selectedIconPath: 'static/tabbar/4-002.png',
text: '我的'
}
]
pagePath: "pages/user/index",
iconPath: "static/tabbar/4-001.png",
selectedIconPath: "static/tabbar/4-002.png",
text: "我的",
},
],
},
permission: {
'scope.userLocation': {
desc: '你的位置信息将用于小程序位置接口的效果展示'
}
"scope.userLocation": {
desc: "你的位置信息将用于小程序位置接口的效果展示",
},
},
requiredBackgroundModes: ['audio', 'location'],
requiredBackgroundModes: ["audio", "location"],
// @ts-ignore
requiredPrivateInfos: ['getLocation']
})
requiredPrivateInfos: ["getLocation"],
});

View File

@@ -1,134 +1,151 @@
<template>
<nut-popup
position="bottom"
closeable
round
safe-area-inset-bottom
:close-on-click-overlay="false"
:style="{ height: 'auto' }"
v-model:visible="isShowPay"
@click-close-icon="closePay"
>
<view class="div">
<view style="text-align: center">支付方式</view>
<nut-cell-group>
<nut-cell
v-if="payType === 'wx'"
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
v-if="payType === 'jf'"
title="积分支付"
desc="剩余积分:18888"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
<nut-popup
position="bottom"
closeable
round
safe-area-inset-bottom
:close-on-click-overlay="false"
:style="{ height: 'auto' }"
v-model:visible="isShowPay"
@click-close-icon="closePay"
>
<view class="div">
<view style="text-align: center">支付方式</view>
<nut-cell-group>
<nut-cell
v-if="payType === 'wx'"
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
v-if="payType === 'jf'"
title="积分支付"
desc="剩余积分:18888"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
</template>
<script setup lang="ts">
import {IconFont} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import {payOrder} from '@/api/order'
import {payJfOrder} from '@/api/goods'
import { IconFont } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import { payOrder } from "@/api/order";
import { payJfOrder } from "@/api/goods";
const prop = defineProps({
isShowPay: {
required: true,
type: Boolean,
default: false
},
payType: {
required: true,
type: String,
default: 'wx'
},
jfInfo: {
type: Object,
default: () => {
return {}
}
}
})
isShowPay: {
required: true,
type: Boolean,
default: false,
},
payType: {
required: true,
type: String,
default: "wx",
},
jfInfo: {
type: Object,
default: () => {
return {};
},
},
});
const emit = defineEmits(['closePay'])
const emit = defineEmits(["closePay"]);
const goPay = async () => {
if (prop.payType === 'wx') {
try {
const {data} = await payOrder({gid: 1, token: Taro.getStorageSync('token')})
Taro.requestPayment({
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
success: function (res) {
console.log(res)
},
fail: function (res) {
console.log(res)
if (!prop.jfInfo)
return Taro.showToast({
title: "未获取到订单信息",
icon: "none",
});
if (prop.payType === "wx") {
try {
console.log(prop.jfInfo);
const { data } = await payOrder({
oid: prop.jfInfo.oid,
});
Taro.requestPayment({
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
success: function (res) {
console.log(res);
Taro.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
},
fail: function (res) {
console.log(res);
Taro.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
},
});
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
} else {
const res = await payJfOrder(prop.jfInfo);
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
}
} else {
if (!prop.jfInfo) return Taro.showToast({
title: '未获取到订单信息',
icon: 'none'
})
console.log(prop.jfInfo)
const res = await payJfOrder(prop.jfInfo)
Taro.showToast({
title: res.msg,
icon: 'success',
duration: 2000
})
}
emit('closePay', false)
}
emit("closePay", false);
};
const closePay = () => {
emit('closePay', false)
}
Taro.showToast({
title: "取消支付",
icon: "none",
});
emit("closePay", false);
};
</script>
<style lang="scss">
.nut-popup {
.nut-popup__container {
border-radius: 10px;
}
.nut-popup__container {
border-radius: 10px;
}
}
.div {
padding: 20px;
// text-align: center;
padding: 20px;
// text-align: center;
.nut-cell {
align-items: center;
}
.nut-cell {
align-items: center;
}
}
</style>

View File

@@ -10,7 +10,7 @@
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { orderVerify } from "@/api/admin";
import { orderVerify, activeOrderVerify } from "@/api/admin";
// url参数转对象
// const urlParse = (url: string) => {
@@ -34,9 +34,17 @@ const scanCode = () => {
scanType: ["qrCode"],
success: async (res) => {
try {
const data = await orderVerify({
oid: res.result,
});
const user = JSON.parse(Taro.getStorageSync("userInfo"));
let data;
if (user.mer_type === 1) {
data = await activeOrderVerify({
oid: res.result,
});
} else {
data = await orderVerify({
oid: res.result,
});
}
Taro.showToast({
title: data.msg,
icon: "none",

View File

@@ -6,11 +6,37 @@
<Home class="iconfont" @click="goHome" />
</view>
</view>
<!-- <swiper class="swiper" :autoplay="true" :circular="true">
<swiper-item v-for="(item, index) in swiperList" :key="index">
<image style="width: 100%" :src="item"></image>
</swiper-item>
</swiper> -->
<nut-swiper
class="swiper"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
>
<nut-swiper-item>
<image
src="https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg"
alt=""
/>
</nut-swiper-item>
<nut-swiper-item>
<image
src="https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg"
alt=""
/>
</nut-swiper-item>
<nut-swiper-item>
<image
src="https://storage.360buyimg.com/jdc-article/welcomenutui.jpg"
alt=""
/>
</nut-swiper-item>
<nut-swiper-item>
<image
src="https://storage.360buyimg.com/jdc-article/fristfabu.jpg"
alt=""
/>
</nut-swiper-item>
</nut-swiper>
<view class="box">
<view class="line"></view>
<view class="game-title"></view>
@@ -31,13 +57,17 @@ import {
navigateTo,
} from "@tarojs/taro";
import { Left, Home } from "@nutui/icons-vue-taro";
var statusBarHeight = (getSystemInfoSync().statusBarHeight as number) - 7;
var statusBarHeight = (getSystemInfoSync().statusBarHeight as number);
console.log(statusBarHeight);
const statusHeight = ref<number>(statusBarHeight);
const swiperList = ref([]);
useLoad(() => {});
useLoad((options) => {
console.log(options);
});
const returns = () => {
navigateBack();
@@ -83,6 +113,13 @@ const toGame = () => {
}
}
}
.swiper {
height: 450rpx;
width: 100vw;
image {
width: 100%;
}
}
.box {
width: 100%;

View File

View File

@@ -0,0 +1,13 @@
<template>
<view>
</view>
</template>
<script setup lang="ts">
</script>
<style lang="scss">
</style>

View File

@@ -1,99 +1,97 @@
<template>
<view class="app">
<view class="head-wrapper" :style="'top:' + BarHeight + 'px'">
<view class="head-menu">
<Left class="iconfont" @click="returns"/>
<Home class="iconfont" @click="goHome"/>
</view>
</view>
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :src="itm.url" :alt="itm.id.toString()"/>
</nut-swiper-item>
</nut-swiper>
<!-- 标题价格 -->
<view class="card">
<view>
<nut-price
size="large"
:price="goodInfo.number as number"
position="after"
symbol="积分"
/>
</view>
<view class="title"
>{{ goodInfo.name }}
</view
>
</view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 -->
<view class="rich-box">
<view class="title">产品介绍</view>
<view v-if="goodInfo.details" v-html="goodInfo.details"></view>
<nut-empty v-else description="暂无产品介绍"></nut-empty>
</view>
<!-- 底部 -->
<view class="bottom-box">
<view class="left">
<view class="icon" @click="toPage('/pages/index/index')">
<Home/>
<view>首页</view>
<view class="app">
<view class="head-wrapper" :style="`top:${BarHeight}px`">
<view class="head-menu">
<Left class="iconfont" @click="returns" />
<Home class="iconfont" @click="goHome" />
</view>
</view>
<view class="icon" @click="toPage('/pages/cart/index')">
<Cart/>
<view>购物车</view>
</view>
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
<My/>
<view>客服</view>
</view>
</view>
<!-- 占位 -->
<view style="height: 155px"></view>
<view>
<nut-button
style="margin-right: 10px"
type="warning"
@click="add_cart()"
>加入购物车
</nut-button
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
>
<nut-button type="primary" @click="toOrderDetail()"
>立即兑换
</nut-button
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :src="itm.url" :alt="itm.id.toString()" />
</nut-swiper-item>
</nut-swiper>
<!-- 标题价格 -->
<view class="card">
<view>
<nut-price
size="large"
:price="goodInfo.number as number"
position="after"
:symbol="payType === 'jf' ? '积分' : '元'"
/>
</view>
<view class="title">{{ goodInfo.name }} </view>
</view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 -->
<view class="rich-box">
<view class="title">产品介绍</view>
<view v-if="goodInfo.details" v-html="goodInfo.details"></view>
<nut-empty v-else description="暂无产品介绍"></nut-empty>
</view>
<!-- 底部 -->
<view class="bottom-box">
<view class="left">
<view class="icon" @click="toPage('/pages/index/index')">
<Home />
<view>首页</view>
</view>
<view class="icon" v-if="payType === 'jf'" @click="toPage('/pages/cart/index')">
<Cart />
<view>购物车</view>
</view>
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
<My />
<view>客服</view>
</view>
</view>
<!-- 占位 -->
<view style="height: 155px"></view>
<view>
<nut-button
v-if="payType === 'jf'"
style="margin-right: 10px"
type="warning"
@click="add_cart()"
>加入购物车
</nut-button>
<nut-button :style="payType === 'wx' ? 'width: 200px':''" type="primary" @click="toOrderDetail()"
>{{ payType === "jf" ? "立即兑换" : "立即购买" }}
</nut-button>
</view>
</view>
<!-- 规格选择 -->
<nut-popup
position="bottom"
overlay-class="overlay"
safe-area-inset-bottom
closeable
round
:style="{ zIndex: 1 }"
v-model:visible="isSkuShow"
>
</view>
</view>
<!-- 规格选择 -->
<nut-popup
position="bottom"
overlay-class="overlay"
safe-area-inset-bottom
closeable
round
:style="{zIndex: 1 }"
v-model:visible="isSkuShow"
>
<view class="sku-box">
<view>商品规格</view>
<nut-cell-group>
<nut-cell title="数量:">
<template v-slot:link>
<nut-input-number v-model="count" @change="addCount"/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
<!-- <nut-sku
<view class="sku-box">
<view>商品规格</view>
<nut-cell-group>
<nut-cell title="数量:">
<template v-slot:link>
<nut-input-number
v-model="count"
@change="addCount"
/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
<!-- <nut-sku
v-model:visible="isSkuShow"
:sku="sku"
:goods="goods"
@@ -101,305 +99,322 @@
@clickBtnOperate="clickBtnOperate"
@close="close"
></nut-sku> -->
<Pay :is-show-pay="isShowPay" pay-type="jf" :jfInfo="orderData" @closePay="closePay"/>
</view>
<Pay
:is-show-pay="isShowPay"
:pay-type="payType"
v-model:jfInfo="orderData"
@closePay="closePay"
/>
</view>
</template>
<script setup lang="ts">
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight
import {ref} from 'vue'
import Taro from '@tarojs/taro'
import {Left, Home, Cart, My} from '@nutui/icons-vue-taro'
import {getGoodsDetail, addCart, createOrder, payOrder} from '@/api/goods'
import Pay from '@/components/Pay.vue'
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
import { ref } from "vue";
import Taro from "@tarojs/taro";
import { Left, Home, Cart, My } from "@nutui/icons-vue-taro";
import {
getGoodsDetail,
getActiveGoodsDetail,
addCart,
createOrder,
payOrder,
createActiveOrder,
} from "@/api/goods";
import Pay from "@/components/Pay.vue";
const BarHeight = ref((statusBarHeight as number) + 7)
const BarHeight = ref((statusBarHeight as number) + 7);
const swiperList = ref([
{
id: 1,
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg'
},
{
id: 2,
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg'
},
{
id: 3,
url: 'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg'
},
{
id: 4,
url: 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
}
])
{
id: 1,
url: "https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg",
},
{
id: 2,
url: "https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg",
},
{
id: 3,
url: "https://storage.360buyimg.com/jdc-article/welcomenutui.jpg",
},
{
id: 4,
url: "https://storage.360buyimg.com/jdc-article/fristfabu.jpg",
},
]);
const isSkuShow = ref(false)
const isSkuShow = ref(false);
const isShowPay = ref(false)
const isShowPay = ref(false);
const sku = ref([])
const sku = ref([]);
const orderData = ref([])
const payType = ref("");
const count = ref(1)
const orderData = ref([]);
const count = ref(1);
interface GoodInfo {
gid?: number
name?: string
number?: number
cover?: string
details?: string
sku?: any[]
stock?: number
gid?: number;
name?: string;
number?: number;
cover?: string;
details?: string;
sku?: any[];
stock?: number;
}
const goodInfo = ref<GoodInfo>({})
const goodInfo = ref<GoodInfo>({});
Taro.useLoad((options) => {
get_good_detail(options.gid)
})
payType.value = options.type === "1" ? "wx" : "jf";
get_good_detail(options.gid);
});
const get_good_detail = async (gid: string) => {
try {
const res = await getGoodsDetail({gid: Number(gid)})
goodInfo.value = res.data.data
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
}
try {
let res: any;
if (payType.value === "jf") {
res = await getGoodsDetail({ gid: Number(gid) });
} else {
res = await getActiveGoodsDetail({ gid: gid });
}
goodInfo.value = res.data.data;
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
};
const addCount = () => {
if (count.value >= (goodInfo.value.stock as number)) {
count.value = goodInfo.value.stock as number
Taro.showToast({
title: '库存不足',
icon: 'none'
})
return
}
}
if (count.value >= (goodInfo.value.stock as number)) {
count.value = goodInfo.value.stock as number;
Taro.showToast({
title: "库存不足",
icon: "none",
});
return;
}
};
const returns = () => {
Taro.navigateBack({
delta: 1
})
}
Taro.navigateBack({
delta: 1,
});
};
const goHome = () => {
Taro.switchTab({
url: '/pages/index/index'
})
}
Taro.switchTab({
url: "/pages/index/index",
});
};
const openSku = () => {
isSkuShow.value = true
}
isSkuShow.value = true;
};
const selectSku = () => {
}
const clickBtnOperate = () => {
}
const close = () => {
}
const selectSku = () => {};
const clickBtnOperate = () => {};
const close = () => {};
const add_cart = async () => {
if (isSkuShow.value === false) return openSku()
try {
await addCart({gid: Number(goodInfo.value.gid)})
Taro.showToast({
title: '加入购物车成功',
icon: 'success',
duration: 2000
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
isSkuShow.value = false
}
if (isSkuShow.value === false) return openSku();
try {
await addCart({ gid: Number(goodInfo.value.gid) });
Taro.showToast({
title: "加入购物车成功",
icon: "success",
duration: 2000,
});
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
isSkuShow.value = false;
};
const toOrderDetail = async () => {
if (isSkuShow.value === false) return openSku()
// Taro.navigateTo({
// url: '/pages/goods/order_create/index'
// })
try {
const {data} = await createOrder([
{
gid: Number(goodInfo.value.gid),
count: Number(count.value)
}
])
// 删除不必要的字段
// orderData.value = data.data.map((item: any) => {
// delete item.ID
// delete item.uid
// delete item.status
// delete item.add_time
// delete item.expires
// return item
if (isSkuShow.value === false) return openSku();
// Taro.navigateTo({
// url: '/pages/goods/order_create/index'
// })
orderData.value = data.data
try {
let res: any;
if (payType.value === "jf") {
res = await createOrder([
{
gid: Number(goodInfo.value.gid),
count: Number(count.value),
},
]);
} else {
res = await createActiveOrder({
gid: goodInfo.value.gid,
stock: count.value,
});
}
isShowPay.value = true
orderData.value = res.data.data;
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
isShowPay.value = true;
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
isSkuShow.value = false
}
isSkuShow.value = false;
};
const closePay = (val: boolean) => {
isShowPay.value = val
orderData.value = []
}
isShowPay.value = val;
orderData.value = [];
};
const toPage = (url: string, type: number = 1) => {
if (type === 1) {
Taro.switchTab({
url: url
})
} else {
// Taro.navigateTo({
// url: url,
// });
Taro.showToast({
title: '暂未开放',
icon: 'none'
})
}
}
if (type === 1) {
Taro.switchTab({
url: url,
});
} else {
// Taro.navigateTo({
// url: url,
// });
Taro.showToast({
title: "暂未开放",
icon: "none",
});
}
};
</script>
<style lang="scss">
// sku遮罩
.overlay {
background-color: rgba(0, 0, 0, 0.5);
z-index: 1 !important;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1 !important;
}
.head-wrapper {
z-index: 999;
display: flex;
align-items: center;
position: fixed;
left: 30px;
top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114px;
/* #endif */
z-index: 999;
display: flex;
align-items: center;
position: fixed;
left: 30px;
top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114px;
/* #endif */
}
.head-menu {
display: flex;
align-items: center;
height: 54px;
width: 140px;
background: rgba(0, 0, 0, 0.25);
border-radius: 27px;
display: flex;
align-items: center;
height: 54px;
width: 140px;
background: rgba(0, 0, 0, 0.25);
border-radius: 27px;
.iconfont {
flex: 1;
text-align: center;
color: #fff;
box-sizing: border-box;
}
.iconfont {
flex: 1;
text-align: center;
color: #fff;
box-sizing: border-box;
}
}
.nut-swiper-item img {
width: 100%;
height: 450px;
width: 100%;
height: 450px;
}
.card {
padding: 30px;
background-color: #fff;
padding: 30px;
background-color: #fff;
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
}
.rich-box {
background-color: #fff;
margin-top: 20px;
width: 100vw;
box-sizing: border-box;
text-align: center;
padding: 15px 0;
background-color: #fff;
margin-top: 20px;
width: 100vw;
box-sizing: border-box;
text-align: center;
padding: 15px 0;
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
}
.nut-sku {
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.sku-box {
padding: 100px 50px;
padding: 100px 50px;
}
.bottom-box {
border-top: 1px solid #e5e5e585;
position: fixed;
bottom: 0;
height: 5.5vh;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
.left {
border-top: 1px solid #e5e5e585;
position: fixed;
bottom: 0;
height: 5.5vh;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
width: 300px;
padding: 0 20px;
box-sizing: border-box;
align-items: center;
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
width: 100vw;
.left {
display: flex;
align-items: center;
justify-content: flex-start;
width: 300px;
padding: 0 20px;
box-sizing: border-box;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
width: 100px;
// margin-right: 100px;
}
}
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
}
}
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
}
}
</style>

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '活动商品',
})

View File

@@ -0,0 +1,135 @@
<template>
<view>
<!-- 金刚区 -->
<view class="top-box">
<view class="item">
<view>我的订单</view>
</view>
<view class="item">
<view></view>
</view>
<view class="item">
</view>
<view class="item">
<view></view>
</view>
</view>
<!-- 商品列表 -->
<view class="goodBox">
<view
class="good"
v-for="item in list"
:key="item.gid"
@click.stop="toGoodDetails(item.gid as number)"
>
<image :src="(item.cover as string)" />
<view class="good-text-box">
<text class="good-text">{{ item.name }} </text>
<view class="good-price-box">
<text class="good-text-price">
¥
<text style="font-size: 20px">{{
item.number
}}</text>
</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { useLoad, navigateTo } from "@tarojs/taro";
import { getActiveGoods } from "../../../api/goods";
const list = ref<any>([]);
useLoad(() => {
getList();
});
const getList = async () => {
const res = await getActiveGoods();
console.log(res);
list.value = res.data.data;
};
const toGoodDetails = (id: number) => {
navigateTo({
url: `/pages/goods/goods_detail/index?gid=${id}&type=1`,
});
};
</script>
<style lang="scss">
.top-box {
display: flex;
justify-content: space-between;
margin: 10px 20px 0 20px;
.item {
width: 150px;
height: 150px;
background-color: #fff;
border-radius: 10px;
text-align: center;
line-height: 150px;
}
}
.goodBox {
display: flex;
padding: 20px;
flex-wrap: wrap;
justify-content: space-between;
.good {
width: 340px;
background-color: #fff;
margin-bottom: 20px;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
image {
width: 100%;
height: 350px;
}
.good-text-box {
padding: 10px;
.good-text {
flex-shrink: 0;
font-size: 28px;
color: #333;
font-weight: 400;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-word;
}
.good-price-box {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
.good-text-price {
font-size: 28px;
font-weight: bold;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
}
}
</style>

View File

@@ -40,7 +40,7 @@
@click.stop="toGoodDetails(item.gid as number)"
>
<image
:src="item.cover"
:src="(item.cover as string)"
/>
<view class="good-text-box">
<text class="good-text"
@@ -52,7 +52,7 @@
<text style="font-size: 20px">{{ item.number }}</text>
积分
</text>
<Cart size="20" color="#ff0000" @click.stop="add_cart(item.gid)"/>
<Cart size="20" color="#ff0000" @click.stop="add_cart(item.gid as number)"/>
</view>
</view>
</view>
@@ -99,7 +99,7 @@ const userMenuList = ref([
{
id: 2,
label: '活动商品',
url: '',
url: '/pages/hotGoods/index/index',
icon: 'http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png'
},
{

View File

@@ -152,11 +152,11 @@ const toDetail = (item: any) => {
<view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 1
item.status === 0
? "待付款"
: item.status === 2
: item.status === 1
? "待使用"
: item.status === 3
: item.status === 2
? "已使用"
: "已失效"
}}</view>

View File

@@ -18,22 +18,12 @@
"jsx": "preserve",
"allowJs": true,
"resolveJsonModule": true,
"typeRoots": [
"node_modules/@types"
],
"types": [
"@tarojs/components/vue3"
],
"typeRoots": ["node_modules/@types"],
"types": ["@tarojs/components/vue3"],
"paths": {
"@/*": [
"src/*"
]
"@/*": ["src/*"]
}
},
"include": [
"./src",
"./types",
"components.d.ts"
],
"include": ["./src", "./types", "components.d.ts"],
"compileOnSave": false
}