i
This commit is contained in:
@@ -53,7 +53,6 @@
|
|||||||
"@tarojs/shared": "3.6.11",
|
"@tarojs/shared": "3.6.11",
|
||||||
"@tarojs/taro": "3.6.11",
|
"@tarojs/taro": "3.6.11",
|
||||||
"pinia": "^2.1.6",
|
"pinia": "^2.1.6",
|
||||||
"uqrcodejs": "^4.0.7",
|
|
||||||
"vue": "^3.2.40"
|
"vue": "^3.2.40"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -2,3 +2,6 @@ import request from '../utils/request';
|
|||||||
|
|
||||||
// 订单核销
|
// 订单核销
|
||||||
export const orderVerify = (data: object) => request('/user/cancelPointOrder', data, 'POST');
|
export const orderVerify = (data: object) => request('/user/cancelPointOrder', data, 'POST');
|
||||||
|
|
||||||
|
// 活动订单核销
|
||||||
|
export const activeOrderVerify = (data: object) => request('/user/cancelOrder', data, 'POST');
|
||||||
|
|||||||
@@ -17,3 +17,12 @@ 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')
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import request from '@/utils/request'
|
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')
|
||||||
@@ -1,86 +1,87 @@
|
|||||||
export default defineAppConfig({
|
export default defineAppConfig({
|
||||||
pages: [
|
pages: [
|
||||||
'pages/index/index',
|
"pages/index/index",
|
||||||
'pages/category/index',
|
"pages/category/index",
|
||||||
'pages/cart/index',
|
"pages/cart/index",
|
||||||
'pages/user/index',
|
"pages/user/index",
|
||||||
],
|
],
|
||||||
subPackages: [
|
subPackages: [
|
||||||
{
|
{
|
||||||
root: 'pages/users',
|
root: "pages/users",
|
||||||
pages: [
|
pages: [
|
||||||
'order_list/index',
|
"order_list/index",
|
||||||
'setting/index',
|
"setting/index",
|
||||||
'user_setting/index',
|
"user_setting/index",
|
||||||
'settled_mer/index',
|
"settled_mer/index",
|
||||||
'order_list_detail/index',
|
"order_list_detail/index",
|
||||||
'account/index'
|
"account/index",
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: 'pages/goods',
|
root: "pages/goods",
|
||||||
pages: [
|
pages: [
|
||||||
'goods_detail/index',
|
"goods_detail/index",
|
||||||
'order_create/index',
|
"order_create/index",
|
||||||
'order_status/index'
|
"order_status/index",
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: 'pages/admin',
|
root: "pages/admin",
|
||||||
pages: ['verify/index']
|
pages: ["verify/index"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: 'pages/game',
|
root: "pages/game",
|
||||||
pages: [
|
pages: ["gamehome/index", "gamedetail/index", "gameview/index"],
|
||||||
'gamehome/index',
|
},
|
||||||
'gamedetail/index',
|
{
|
||||||
]
|
root: "pages/hotGoods",
|
||||||
}
|
pages: ["index/index"],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: 'light',
|
backgroundTextStyle: "light",
|
||||||
navigationBarBackgroundColor: '#fff',
|
navigationBarBackgroundColor: "#fff",
|
||||||
navigationBarTitleText: 'WeChat',
|
navigationBarTitleText: "WeChat",
|
||||||
navigationBarTextStyle: 'black'
|
navigationBarTextStyle: "black",
|
||||||
},
|
},
|
||||||
tabBar: {
|
tabBar: {
|
||||||
color: '#666666',
|
color: "#666666",
|
||||||
selectedColor: '#ff0000',
|
selectedColor: "#ff0000",
|
||||||
backgroundColor: '#ffffff',
|
backgroundColor: "#ffffff",
|
||||||
borderStyle: 'white',
|
borderStyle: "white",
|
||||||
list: [
|
list: [
|
||||||
{
|
{
|
||||||
pagePath: 'pages/index/index',
|
pagePath: "pages/index/index",
|
||||||
iconPath: 'static/tabbar/1-001.png',
|
iconPath: "static/tabbar/1-001.png",
|
||||||
selectedIconPath: 'static/tabbar/1-002.png',
|
selectedIconPath: "static/tabbar/1-002.png",
|
||||||
text: '首页'
|
text: "首页",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pagePath: 'pages/category/index',
|
pagePath: "pages/category/index",
|
||||||
iconPath: 'static/tabbar/2-001.png',
|
iconPath: "static/tabbar/2-001.png",
|
||||||
selectedIconPath: 'static/tabbar/2-002.png',
|
selectedIconPath: "static/tabbar/2-002.png",
|
||||||
text: '分类'
|
text: "分类",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pagePath: 'pages/cart/index',
|
pagePath: "pages/cart/index",
|
||||||
iconPath: 'static/tabbar/3-001.png',
|
iconPath: "static/tabbar/3-001.png",
|
||||||
selectedIconPath: 'static/tabbar/3-002.png',
|
selectedIconPath: "static/tabbar/3-002.png",
|
||||||
text: '购物车'
|
text: "购物车",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pagePath: 'pages/user/index',
|
pagePath: "pages/user/index",
|
||||||
iconPath: 'static/tabbar/4-001.png',
|
iconPath: "static/tabbar/4-001.png",
|
||||||
selectedIconPath: 'static/tabbar/4-002.png',
|
selectedIconPath: "static/tabbar/4-002.png",
|
||||||
text: '我的'
|
text: "我的",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
permission: {
|
permission: {
|
||||||
'scope.userLocation': {
|
"scope.userLocation": {
|
||||||
desc: '你的位置信息将用于小程序位置接口的效果展示'
|
desc: "你的位置信息将用于小程序位置接口的效果展示",
|
||||||
}
|
|
||||||
},
|
},
|
||||||
requiredBackgroundModes: ['audio', 'location'],
|
},
|
||||||
|
requiredBackgroundModes: ["audio", "location"],
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
requiredPrivateInfos: ['getLocation']
|
requiredPrivateInfos: ["getLocation"],
|
||||||
})
|
});
|
||||||
|
|||||||
@@ -46,36 +46,44 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {IconFont} from '@nutui/icons-vue-taro'
|
import { IconFont } from "@nutui/icons-vue-taro";
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from "@tarojs/taro";
|
||||||
import {payOrder} from '@/api/order'
|
import { payOrder } from "@/api/order";
|
||||||
import {payJfOrder} from '@/api/goods'
|
import { payJfOrder } from "@/api/goods";
|
||||||
|
|
||||||
const prop = defineProps({
|
const prop = defineProps({
|
||||||
isShowPay: {
|
isShowPay: {
|
||||||
required: true,
|
required: true,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
payType: {
|
payType: {
|
||||||
required: true,
|
required: true,
|
||||||
type: String,
|
type: String,
|
||||||
default: 'wx'
|
default: "wx",
|
||||||
},
|
},
|
||||||
jfInfo: {
|
jfInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {}
|
return {};
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['closePay'])
|
const emit = defineEmits(["closePay"]);
|
||||||
|
|
||||||
const goPay = async () => {
|
const goPay = async () => {
|
||||||
if (prop.payType === 'wx') {
|
if (!prop.jfInfo)
|
||||||
|
return Taro.showToast({
|
||||||
|
title: "未获取到订单信息",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
if (prop.payType === "wx") {
|
||||||
try {
|
try {
|
||||||
const {data} = await payOrder({gid: 1, token: Taro.getStorageSync('token')})
|
console.log(prop.jfInfo);
|
||||||
|
const { data } = await payOrder({
|
||||||
|
oid: prop.jfInfo.oid,
|
||||||
|
});
|
||||||
Taro.requestPayment({
|
Taro.requestPayment({
|
||||||
timeStamp: data.data.timeStamp,
|
timeStamp: data.data.timeStamp,
|
||||||
nonceStr: data.data.nonceStr,
|
nonceStr: data.data.nonceStr,
|
||||||
@@ -83,37 +91,46 @@ const goPay = async () => {
|
|||||||
signType: data.data.signType,
|
signType: data.data.signType,
|
||||||
paySign: data.data.paySign,
|
paySign: data.data.paySign,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log(res)
|
console.log(res);
|
||||||
|
Taro.showToast({
|
||||||
|
title: "支付成功",
|
||||||
|
icon: "success",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
fail: function (res) {
|
fail: function (res) {
|
||||||
console.log(res)
|
console.log(res);
|
||||||
}
|
Taro.showToast({
|
||||||
})
|
title: "支付失败",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: e.msg,
|
title: e.msg,
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!prop.jfInfo) return Taro.showToast({
|
const res = await payJfOrder(prop.jfInfo);
|
||||||
title: '未获取到订单信息',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
console.log(prop.jfInfo)
|
|
||||||
const res = await payJfOrder(prop.jfInfo)
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'success',
|
icon: "success",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
emit('closePay', false)
|
emit("closePay", false);
|
||||||
}
|
};
|
||||||
|
|
||||||
const closePay = () => {
|
const closePay = () => {
|
||||||
emit('closePay', false)
|
Taro.showToast({
|
||||||
}
|
title: "取消支付",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
emit("closePay", false);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { orderVerify } from "@/api/admin";
|
import { orderVerify, activeOrderVerify } from "@/api/admin";
|
||||||
|
|
||||||
// url参数转对象
|
// url参数转对象
|
||||||
// const urlParse = (url: string) => {
|
// const urlParse = (url: string) => {
|
||||||
@@ -34,9 +34,17 @@ const scanCode = () => {
|
|||||||
scanType: ["qrCode"],
|
scanType: ["qrCode"],
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
try {
|
try {
|
||||||
const data = await orderVerify({
|
const user = JSON.parse(Taro.getStorageSync("userInfo"));
|
||||||
|
let data;
|
||||||
|
if (user.mer_type === 1) {
|
||||||
|
data = await activeOrderVerify({
|
||||||
oid: res.result,
|
oid: res.result,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
data = await orderVerify({
|
||||||
|
oid: res.result,
|
||||||
|
});
|
||||||
|
}
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: data.msg,
|
title: data.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
|||||||
@@ -6,11 +6,37 @@
|
|||||||
<Home class="iconfont" @click="goHome" />
|
<Home class="iconfont" @click="goHome" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <swiper class="swiper" :autoplay="true" :circular="true">
|
<nut-swiper
|
||||||
<swiper-item v-for="(item, index) in swiperList" :key="index">
|
class="swiper"
|
||||||
<image style="width: 100%" :src="item"></image>
|
:pagination-visible="true"
|
||||||
</swiper-item>
|
pagination-color="#426543"
|
||||||
</swiper> -->
|
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="box">
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="game-title"></view>
|
<view class="game-title"></view>
|
||||||
@@ -31,13 +57,17 @@ import {
|
|||||||
navigateTo,
|
navigateTo,
|
||||||
} from "@tarojs/taro";
|
} from "@tarojs/taro";
|
||||||
import { Left, Home } from "@nutui/icons-vue-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 statusHeight = ref<number>(statusBarHeight);
|
||||||
|
|
||||||
const swiperList = ref([]);
|
const swiperList = ref([]);
|
||||||
|
|
||||||
useLoad(() => {});
|
useLoad((options) => {
|
||||||
|
console.log(options);
|
||||||
|
});
|
||||||
|
|
||||||
const returns = () => {
|
const returns = () => {
|
||||||
navigateBack();
|
navigateBack();
|
||||||
@@ -83,6 +113,13 @@ const toGame = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.swiper {
|
||||||
|
height: 450rpx;
|
||||||
|
width: 100vw;
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
0
src/pages/game/gameview/index.config.ts
Normal file
0
src/pages/game/gameview/index.config.ts
Normal file
13
src/pages/game/gameview/index.vue
Normal file
13
src/pages/game/gameview/index.vue
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app">
|
<view class="app">
|
||||||
<view class="head-wrapper" :style="'top:' + BarHeight + 'px'">
|
<view class="head-wrapper" :style="`top:${BarHeight}px`">
|
||||||
<view class="head-menu">
|
<view class="head-menu">
|
||||||
<Left class="iconfont" @click="returns"/>
|
<Left class="iconfont" @click="returns" />
|
||||||
<Home class="iconfont" @click="goHome"/>
|
<Home class="iconfont" @click="goHome" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 幻灯片 -->
|
<!-- 幻灯片 -->
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
auto-play="3000"
|
auto-play="3000"
|
||||||
>
|
>
|
||||||
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
||||||
<img :src="itm.url" :alt="itm.id.toString()"/>
|
<img :src="itm.url" :alt="itm.id.toString()" />
|
||||||
</nut-swiper-item>
|
</nut-swiper-item>
|
||||||
</nut-swiper>
|
</nut-swiper>
|
||||||
<!-- 标题价格 -->
|
<!-- 标题价格 -->
|
||||||
@@ -24,13 +24,10 @@
|
|||||||
size="large"
|
size="large"
|
||||||
:price="goodInfo.number as number"
|
:price="goodInfo.number as number"
|
||||||
position="after"
|
position="after"
|
||||||
symbol="积分"
|
:symbol="payType === 'jf' ? '积分' : '元'"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="title"
|
<view class="title">{{ goodInfo.name }} </view>
|
||||||
>{{ goodInfo.name }}
|
|
||||||
</view
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
|
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
|
||||||
<!-- 产品介绍 -->
|
<!-- 产品介绍 -->
|
||||||
@@ -43,15 +40,15 @@
|
|||||||
<view class="bottom-box">
|
<view class="bottom-box">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="icon" @click="toPage('/pages/index/index')">
|
<view class="icon" @click="toPage('/pages/index/index')">
|
||||||
<Home/>
|
<Home />
|
||||||
<view>首页</view>
|
<view>首页</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="icon" @click="toPage('/pages/cart/index')">
|
<view class="icon" v-if="payType === 'jf'" @click="toPage('/pages/cart/index')">
|
||||||
<Cart/>
|
<Cart />
|
||||||
<view>购物车</view>
|
<view>购物车</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
|
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
|
||||||
<My/>
|
<My />
|
||||||
<view>客服</view>
|
<view>客服</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -59,16 +56,15 @@
|
|||||||
<view style="height: 155px"></view>
|
<view style="height: 155px"></view>
|
||||||
<view>
|
<view>
|
||||||
<nut-button
|
<nut-button
|
||||||
|
v-if="payType === 'jf'"
|
||||||
style="margin-right: 10px"
|
style="margin-right: 10px"
|
||||||
type="warning"
|
type="warning"
|
||||||
@click="add_cart()"
|
@click="add_cart()"
|
||||||
>加入购物车
|
>加入购物车
|
||||||
</nut-button
|
</nut-button>
|
||||||
>
|
<nut-button :style="payType === 'wx' ? 'width: 200px':''" type="primary" @click="toOrderDetail()"
|
||||||
<nut-button type="primary" @click="toOrderDetail()"
|
>{{ payType === "jf" ? "立即兑换" : "立即购买" }}
|
||||||
>立即兑换
|
</nut-button>
|
||||||
</nut-button
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 规格选择 -->
|
<!-- 规格选择 -->
|
||||||
@@ -78,7 +74,7 @@
|
|||||||
safe-area-inset-bottom
|
safe-area-inset-bottom
|
||||||
closeable
|
closeable
|
||||||
round
|
round
|
||||||
:style="{zIndex: 1 }"
|
:style="{ zIndex: 1 }"
|
||||||
v-model:visible="isSkuShow"
|
v-model:visible="isSkuShow"
|
||||||
>
|
>
|
||||||
<view class="sku-box">
|
<view class="sku-box">
|
||||||
@@ -86,11 +82,13 @@
|
|||||||
<nut-cell-group>
|
<nut-cell-group>
|
||||||
<nut-cell title="数量:">
|
<nut-cell title="数量:">
|
||||||
<template v-slot:link>
|
<template v-slot:link>
|
||||||
<nut-input-number v-model="count" @change="addCount"/>
|
<nut-input-number
|
||||||
|
v-model="count"
|
||||||
|
@change="addCount"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</nut-cell>
|
</nut-cell>
|
||||||
</nut-cell-group>
|
</nut-cell-group>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</nut-popup>
|
</nut-popup>
|
||||||
<!-- <nut-sku
|
<!-- <nut-sku
|
||||||
@@ -101,184 +99,199 @@
|
|||||||
@clickBtnOperate="clickBtnOperate"
|
@clickBtnOperate="clickBtnOperate"
|
||||||
@close="close"
|
@close="close"
|
||||||
></nut-sku> -->
|
></nut-sku> -->
|
||||||
<Pay :is-show-pay="isShowPay" pay-type="jf" :jfInfo="orderData" @closePay="closePay"/>
|
<Pay
|
||||||
|
:is-show-pay="isShowPay"
|
||||||
|
:pay-type="payType"
|
||||||
|
v-model:jfInfo="orderData"
|
||||||
|
@closePay="closePay"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight
|
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
|
||||||
import {ref} from 'vue'
|
import { ref } from "vue";
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from "@tarojs/taro";
|
||||||
import {Left, Home, Cart, My} from '@nutui/icons-vue-taro'
|
import { Left, Home, Cart, My } from "@nutui/icons-vue-taro";
|
||||||
import {getGoodsDetail, addCart, createOrder, payOrder} from '@/api/goods'
|
import {
|
||||||
import Pay from '@/components/Pay.vue'
|
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([
|
const swiperList = ref([
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg'
|
url: "https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg'
|
url: "https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
url: 'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg'
|
url: "https://storage.360buyimg.com/jdc-article/welcomenutui.jpg",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
url: 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
|
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 {
|
interface GoodInfo {
|
||||||
gid?: number
|
gid?: number;
|
||||||
name?: string
|
name?: string;
|
||||||
number?: number
|
number?: number;
|
||||||
cover?: string
|
cover?: string;
|
||||||
details?: string
|
details?: string;
|
||||||
sku?: any[]
|
sku?: any[];
|
||||||
stock?: number
|
stock?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const goodInfo = ref<GoodInfo>({})
|
const goodInfo = ref<GoodInfo>({});
|
||||||
|
|
||||||
Taro.useLoad((options) => {
|
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) => {
|
const get_good_detail = async (gid: string) => {
|
||||||
try {
|
try {
|
||||||
const res = await getGoodsDetail({gid: Number(gid)})
|
let res: any;
|
||||||
goodInfo.value = res.data.data
|
if (payType.value === "jf") {
|
||||||
|
res = await getGoodsDetail({ gid: Number(gid) });
|
||||||
|
} else {
|
||||||
|
res = await getActiveGoodsDetail({ gid: gid });
|
||||||
|
}
|
||||||
|
goodInfo.value = res.data.data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: e.msg,
|
title: e.msg,
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const addCount = () => {
|
const addCount = () => {
|
||||||
if (count.value >= (goodInfo.value.stock as number)) {
|
if (count.value >= (goodInfo.value.stock as number)) {
|
||||||
count.value = goodInfo.value.stock as number
|
count.value = goodInfo.value.stock as number;
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '库存不足',
|
title: "库存不足",
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const returns = () => {
|
const returns = () => {
|
||||||
Taro.navigateBack({
|
Taro.navigateBack({
|
||||||
delta: 1
|
delta: 1,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const goHome = () => {
|
const goHome = () => {
|
||||||
Taro.switchTab({
|
Taro.switchTab({
|
||||||
url: '/pages/index/index'
|
url: "/pages/index/index",
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const openSku = () => {
|
const openSku = () => {
|
||||||
isSkuShow.value = true
|
isSkuShow.value = true;
|
||||||
}
|
};
|
||||||
|
|
||||||
const selectSku = () => {
|
const selectSku = () => {};
|
||||||
}
|
const clickBtnOperate = () => {};
|
||||||
const clickBtnOperate = () => {
|
const close = () => {};
|
||||||
}
|
|
||||||
const close = () => {
|
|
||||||
}
|
|
||||||
const add_cart = async () => {
|
const add_cart = async () => {
|
||||||
if (isSkuShow.value === false) return openSku()
|
if (isSkuShow.value === false) return openSku();
|
||||||
try {
|
try {
|
||||||
await addCart({gid: Number(goodInfo.value.gid)})
|
await addCart({ gid: Number(goodInfo.value.gid) });
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '加入购物车成功',
|
title: "加入购物车成功",
|
||||||
icon: 'success',
|
icon: "success",
|
||||||
duration: 2000
|
duration: 2000,
|
||||||
})
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: e.msg,
|
title: e.msg,
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
isSkuShow.value = false
|
isSkuShow.value = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
const toOrderDetail = async () => {
|
const toOrderDetail = async () => {
|
||||||
if (isSkuShow.value === false) return openSku()
|
if (isSkuShow.value === false) return openSku();
|
||||||
// Taro.navigateTo({
|
// Taro.navigateTo({
|
||||||
// url: '/pages/goods/order_create/index'
|
// url: '/pages/goods/order_create/index'
|
||||||
// })
|
// })
|
||||||
try {
|
try {
|
||||||
const {data} = await createOrder([
|
let res: any;
|
||||||
|
if (payType.value === "jf") {
|
||||||
|
res = await createOrder([
|
||||||
{
|
{
|
||||||
gid: Number(goodInfo.value.gid),
|
gid: Number(goodInfo.value.gid),
|
||||||
count: Number(count.value)
|
count: Number(count.value),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
res = await createActiveOrder({
|
||||||
|
gid: goodInfo.value.gid,
|
||||||
|
stock: 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
|
|
||||||
// })
|
|
||||||
orderData.value = data.data
|
|
||||||
|
|
||||||
isShowPay.value = true
|
orderData.value = res.data.data;
|
||||||
|
|
||||||
|
isShowPay.value = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: e.msg,
|
title: e.msg,
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
isSkuShow.value = false
|
isSkuShow.value = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
const closePay = (val: boolean) => {
|
const closePay = (val: boolean) => {
|
||||||
isShowPay.value = val
|
isShowPay.value = val;
|
||||||
orderData.value = []
|
orderData.value = [];
|
||||||
}
|
};
|
||||||
|
|
||||||
const toPage = (url: string, type: number = 1) => {
|
const toPage = (url: string, type: number = 1) => {
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
Taro.switchTab({
|
Taro.switchTab({
|
||||||
url: url
|
url: url,
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
// Taro.navigateTo({
|
// Taro.navigateTo({
|
||||||
// url: url,
|
// url: url,
|
||||||
// });
|
// });
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '暂未开放',
|
title: "暂未开放",
|
||||||
icon: 'none'
|
icon: "none",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -369,16 +382,16 @@ const toPage = (url: string, type: number = 1) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 10px;
|
|
||||||
// 适配ios底部安全区域
|
// 适配ios底部安全区域
|
||||||
padding-bottom: constant(safe-area-inset-bottom);
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
width: 100vw;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: flex-start;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -390,6 +403,8 @@ const toPage = (url: string, type: number = 1) => {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
|
width: 100px;
|
||||||
|
// margin-right: 100px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
src/pages/hotGoods/index/index.config.ts
Normal file
4
src/pages/hotGoods/index/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '活动商品',
|
||||||
|
})
|
||||||
|
|
||||||
135
src/pages/hotGoods/index/index.vue
Normal file
135
src/pages/hotGoods/index/index.vue
Normal 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>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
@click.stop="toGoodDetails(item.gid as number)"
|
@click.stop="toGoodDetails(item.gid as number)"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
:src="item.cover"
|
:src="(item.cover as string)"
|
||||||
/>
|
/>
|
||||||
<view class="good-text-box">
|
<view class="good-text-box">
|
||||||
<text class="good-text"
|
<text class="good-text"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<text style="font-size: 20px">{{ item.number }}</text>
|
<text style="font-size: 20px">{{ item.number }}</text>
|
||||||
积分
|
积分
|
||||||
</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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -99,7 +99,7 @@ const userMenuList = ref([
|
|||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
label: '活动商品',
|
label: '活动商品',
|
||||||
url: '',
|
url: '/pages/hotGoods/index/index',
|
||||||
icon: 'http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png'
|
icon: 'http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,11 +152,11 @@ const toDetail = (item: any) => {
|
|||||||
<view class="top">
|
<view class="top">
|
||||||
<view>{{ item.add_time.slice(0, 19) }}</view>
|
<view>{{ item.add_time.slice(0, 19) }}</view>
|
||||||
<view style="color: red">{{
|
<view style="color: red">{{
|
||||||
item.status === 1
|
item.status === 0
|
||||||
? "待付款"
|
? "待付款"
|
||||||
: item.status === 2
|
: item.status === 1
|
||||||
? "待使用"
|
? "待使用"
|
||||||
: item.status === 3
|
: item.status === 2
|
||||||
? "已使用"
|
? "已使用"
|
||||||
: "已失效"
|
: "已失效"
|
||||||
}}</view>
|
}}</view>
|
||||||
|
|||||||
@@ -18,22 +18,12 @@
|
|||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"typeRoots": [
|
"typeRoots": ["node_modules/@types"],
|
||||||
"node_modules/@types"
|
"types": ["@tarojs/components/vue3"],
|
||||||
],
|
|
||||||
"types": [
|
|
||||||
"@tarojs/components/vue3"
|
|
||||||
],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["src/*"]
|
||||||
"src/*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["./src", "./types", "components.d.ts"],
|
||||||
"./src",
|
|
||||||
"./types",
|
|
||||||
"components.d.ts"
|
|
||||||
],
|
|
||||||
"compileOnSave": false
|
"compileOnSave": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user