feat(custom): 新增若干营销功能
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
8
.idea/workspace.xml
generated
Normal file
8
.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PropertiesComponent">{
|
||||||
|
"keyToString": {
|
||||||
|
"settings.editor.selected.configurable": "settings.sync"
|
||||||
|
}
|
||||||
|
}</component>
|
||||||
|
</project>
|
||||||
1
components.d.ts
vendored
1
components.d.ts
vendored
@@ -13,6 +13,7 @@ declare module '@vue/runtime-core' {
|
|||||||
MerList: typeof import('./src/components/MerList.vue')['default']
|
MerList: typeof import('./src/components/MerList.vue')['default']
|
||||||
NutAvatar: typeof import('@nutui/nutui-taro')['Avatar']
|
NutAvatar: typeof import('@nutui/nutui-taro')['Avatar']
|
||||||
NutBacktop: typeof import('@nutui/nutui-taro')['Backtop']
|
NutBacktop: typeof import('@nutui/nutui-taro')['Backtop']
|
||||||
|
NutbigScratchCard: typeof import('@nutui/nutui-taro')['bigScratchCard']
|
||||||
NutButton: typeof import('@nutui/nutui-taro')['Button']
|
NutButton: typeof import('@nutui/nutui-taro')['Button']
|
||||||
NutCalendar: typeof import('@nutui/nutui-taro')['Calendar']
|
NutCalendar: typeof import('@nutui/nutui-taro')['Calendar']
|
||||||
NutCell: typeof import('@nutui/nutui-taro')['Cell']
|
NutCell: typeof import('@nutui/nutui-taro')['Cell']
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const {robot = 1, desc} = argv;
|
|||||||
|
|
||||||
const CIPluginOptFn = async () => {
|
const CIPluginOptFn = async () => {
|
||||||
/**
|
/**
|
||||||
* @typedef { import("@tarojs/plugin-mini-ci").CIOptions } CIOptions
|
* @typedef { import('@tarojs/plugin-mini-ci').CIOptions } CIOptions
|
||||||
* @type {CIOptions}
|
* @type {CIOptions}
|
||||||
*/
|
*/
|
||||||
return {
|
return {
|
||||||
@@ -133,7 +133,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = function (merge) {
|
module.exports = function(merge) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
return merge({}, config, require('./dev'));
|
return merge({}, config, require('./dev'));
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/api/code.ts
Normal file
9
src/api/code.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from "../utils/request";
|
||||||
|
|
||||||
|
// 获取二维码信息
|
||||||
|
export const getQrCode = (data: object) =>
|
||||||
|
request("/qrcode/get", data, "POST");
|
||||||
|
|
||||||
|
// 绑定二维码
|
||||||
|
export const bindQrCode = (data: object) =>
|
||||||
|
request("/qrcode/bind", data, "POST");
|
||||||
@@ -86,3 +86,7 @@ export const getActiveOrderDetail = (data: object) =>
|
|||||||
// 校验交易密码
|
// 校验交易密码
|
||||||
export const checkTradePwd = (data: object) =>
|
export const checkTradePwd = (data: object) =>
|
||||||
request('/user/check/payPassword', data, 'POST');
|
request('/user/check/payPassword', data, 'POST');
|
||||||
|
|
||||||
|
// 获取活动商品或者活动积分商品
|
||||||
|
export const getHdOrJfGoods = (data: object) =>
|
||||||
|
request('/activity/goods', data, 'POST');
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default defineAppConfig({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: 'pages/marketing',
|
root: 'pages/marketing',
|
||||||
pages: ['sign/index'],
|
pages: ['sign/index', 'yq/index', 'scratch/index'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: 'pages/search',
|
root: 'pages/search',
|
||||||
|
|||||||
@@ -1,15 +1,57 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="flex flex-col items-center pt-[208px]">
|
<view class="flex flex-col items-center pt-[208px]">
|
||||||
|
<back />
|
||||||
<image class="h-[152px]" :src="par.header" />
|
<image class="h-[152px]" :src="par.header" />
|
||||||
<view class="list mt-[30px]">
|
<view class="list mt-[30px]" v-if="data.length > 0">
|
||||||
<view class="bg-white w-[700px] h-[300px] rounded-[20px]"></view>
|
<view
|
||||||
|
class="bg-white p-[20px] w-[700px] rounded-[20px] mb-[20px] flex"
|
||||||
|
v-for="(item, index) in data"
|
||||||
|
:key="index">
|
||||||
|
<image
|
||||||
|
class="w-[200px] h-[200px] rounded-[10px] mr-[10px]"
|
||||||
|
:src="item.cover"></image>
|
||||||
|
<view class="flex-1 flex flex-col justify-between">
|
||||||
|
<nut-ellipsis
|
||||||
|
style="font-size: 20px"
|
||||||
|
direction="end"
|
||||||
|
:rows="2"
|
||||||
|
:content="item.name"></nut-ellipsis>
|
||||||
|
<view>
|
||||||
|
<view class="text-[#9E9E9E] text-[26px]"
|
||||||
|
>剩余: {{ item.stock }}</view
|
||||||
|
>
|
||||||
|
<view class="flex justify-between items-end">
|
||||||
|
<view>
|
||||||
|
<view class="text-[#F83D3D] text-[30px] font-bold"
|
||||||
|
>{{ item.number }}元</view
|
||||||
|
>
|
||||||
|
<view class="text-[#F83D3D] text-[30px] font-bold"
|
||||||
|
>{{ item.exchange }}积分</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
|
<nut-button type="primary" size="mini" @click="toPay(item)"
|
||||||
|
>购买</nut-button
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<nut-empty
|
||||||
|
class="mt-[130px]"
|
||||||
|
v-else
|
||||||
|
image="empty"
|
||||||
|
description="暂时没有商品"></nut-empty>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref} from 'vue';
|
import {ref} from 'vue';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
|
import {getHdOrJfGoods, createActiveOrder} from '@/api/goods';
|
||||||
|
import {getUserPoint} from '@/api/admin';
|
||||||
|
import {addCart} from '@/api/cart';
|
||||||
|
import Back from '@/components/Back.vue';
|
||||||
|
|
||||||
const par = ref<any>({});
|
const par = ref<any>({});
|
||||||
|
|
||||||
@@ -32,7 +74,66 @@ Taro.useLoad(e => {
|
|||||||
...par.value,
|
...par.value,
|
||||||
type: e.type,
|
type: e.type,
|
||||||
};
|
};
|
||||||
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const data = ref<any[]>([]);
|
||||||
|
|
||||||
|
const page = ref({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
Taro.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
});
|
||||||
|
const res = await getHdOrJfGoods({
|
||||||
|
PageNum: page.value.page,
|
||||||
|
PageSize: page.value.pageSize,
|
||||||
|
type: Number(par.value.type),
|
||||||
|
});
|
||||||
|
data.value.push(...res.data.data);
|
||||||
|
page.value.itemCount = res.data.total;
|
||||||
|
Taro.hideLoading();
|
||||||
|
};
|
||||||
|
|
||||||
|
Taro.useReachBottom(() => {
|
||||||
|
if (page.value.page < Math.ceil(page.value.itemCount / page.value.pageSize)) {
|
||||||
|
page.value.page++;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const toPay = async item => {
|
||||||
|
const tk = Taro.getStorageSync('token');
|
||||||
|
if (!tk) {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/users/login/index',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await addCart({
|
||||||
|
Bid: item.Store.bid,
|
||||||
|
Gid: item.gid,
|
||||||
|
Number: 1,
|
||||||
|
});
|
||||||
|
const user_info = Taro.getStorageSync('userInfo');
|
||||||
|
const data = await getUserPoint({
|
||||||
|
phone: user_info.data.phone,
|
||||||
|
bid: item.Store.bid,
|
||||||
|
});
|
||||||
|
|
||||||
|
const res = await createActiveOrder({
|
||||||
|
Bid: [item.Store.bid],
|
||||||
|
custID: data.data.store_user_id,
|
||||||
|
});
|
||||||
|
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/pages/goods/pay/index?oid=${res.data.oid}&bid=${item.Store.bid}&OrderType=1`,
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ad {
|
.ad {
|
||||||
background-image: url('https://jdt168.oss-cn-guangzhou.aliyuncs.com/ad.png');
|
// background-image: url('https://jdt168.oss-cn-guangzhou.aliyuncs.com/ad.png');
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697aa0dd9c307b7e95c94d9.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
height: 180px;
|
height: 180px;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
|
|||||||
@@ -41,7 +41,8 @@
|
|||||||
<view class="text">{{ item.name }}</view>
|
<view class="text">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ad" @click="showTips('该功能暂未开放')"></view>
|
<navigator class="ad" url="/pages/marketing/yq/index" open-type="navigate" hover-class="none">
|
||||||
|
</navigator>
|
||||||
<MerList :get-user-location="getUserLocal" />
|
<MerList :get-user-location="getUserLocal" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
3
src/pages/marketing/scratch/index.config.ts
Normal file
3
src/pages/marketing/scratch/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: "刮奖",
|
||||||
|
});
|
||||||
67
src/pages/marketing/scratch/index.scss
Normal file
67
src/pages/marketing/scratch/index.scss
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
page {
|
||||||
|
background-color: #ffab00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg {
|
||||||
|
position: relative;
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697c1bbd9c307b7e97c2665.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
height: 1800px;
|
||||||
|
|
||||||
|
.box {
|
||||||
|
position: absolute;
|
||||||
|
top: 378px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
.tc {
|
||||||
|
height: 365px;
|
||||||
|
width: 575px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textBg {
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697d455d9c307b7e9932fbc.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
font-weight: bolder;
|
||||||
|
font-size: 60px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697c87fd9c307b7e984a370.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
width: 600px;
|
||||||
|
height: 130px;
|
||||||
|
position: absolute;
|
||||||
|
top: 760px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697c956d9c307b7e985b5b9.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
width: 700px;
|
||||||
|
height: 500px;
|
||||||
|
position: absolute;
|
||||||
|
top: 950px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.img1 {
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697c956d9c307b7e985b5c0.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
width: 700px;
|
||||||
|
height: 500px;
|
||||||
|
position: absolute;
|
||||||
|
top: 1500px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
141
src/pages/marketing/scratch/index.vue
Normal file
141
src/pages/marketing/scratch/index.vue
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<template>
|
||||||
|
<view class="bg">
|
||||||
|
<view class="box">
|
||||||
|
<image
|
||||||
|
v-if="status === 0"
|
||||||
|
class="tc"
|
||||||
|
@click="kk"
|
||||||
|
src="https://pic.imgdb.cn/item/6697c82bd9c307b7e9843788.png" />
|
||||||
|
<view
|
||||||
|
class="tc text-[#F33D00] text-center textBg"
|
||||||
|
v-else-if="status === 1">
|
||||||
|
<view>恭喜获得游戏豆奖励</view>
|
||||||
|
<view>{{ codeInfo.pulse }}</view>
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
class="tc"
|
||||||
|
v-else
|
||||||
|
src="https://pic.imgdb.cn/item/6697d32ed9c307b7e991c2c5.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<nut-button
|
||||||
|
v-if="!isLogin"
|
||||||
|
style="width: 100%; height: 100%; opacity: 0"
|
||||||
|
type="primary"
|
||||||
|
open-type="getPhoneNumber"
|
||||||
|
@getphonenumber="getPhoneNumber"
|
||||||
|
>手机号一键登录</nut-button
|
||||||
|
>
|
||||||
|
<nut-button
|
||||||
|
v-else
|
||||||
|
style="width: 100%; height: 100%; opacity: 0"
|
||||||
|
type="primary"
|
||||||
|
@click="ok"
|
||||||
|
>领取</nut-button
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<view class="img"></view>
|
||||||
|
<view class="img1"></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import {ref} from 'vue';
|
||||||
|
import {getPhone, login} from '@/api/user';
|
||||||
|
import {getQrCode, bindQrCode} from '@/api/code';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
const status = ref(0);
|
||||||
|
|
||||||
|
const optData = ref<any>({});
|
||||||
|
|
||||||
|
const isLogin = ref(false);
|
||||||
|
|
||||||
|
const codeInfo = ref<any>({});
|
||||||
|
|
||||||
|
Taro.useLoad(opt => {
|
||||||
|
optData.value = opt;
|
||||||
|
const tk = Taro.getStorageSync('token');
|
||||||
|
if (tk) {
|
||||||
|
isLogin.value = true;
|
||||||
|
}
|
||||||
|
getInfo();
|
||||||
|
});
|
||||||
|
|
||||||
|
const getInfo = async () => {
|
||||||
|
const res = await getQrCode({
|
||||||
|
code: optData.value.qid,
|
||||||
|
});
|
||||||
|
codeInfo.value = res.data.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const kk = () => {
|
||||||
|
if (codeInfo.value.pulse > 0) {
|
||||||
|
status.value = 1;
|
||||||
|
} else {
|
||||||
|
status.value = 2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ok = async () => {
|
||||||
|
const res = await bindQrCode({
|
||||||
|
qid: optData.value.qid,
|
||||||
|
});
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
mask: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const userInfo = ref({
|
||||||
|
phone: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const getPhoneNumber = async (e: any) => {
|
||||||
|
Taro.showLoading({
|
||||||
|
title: '授权手机号中',
|
||||||
|
mask: true,
|
||||||
|
});
|
||||||
|
const {code} = e.detail;
|
||||||
|
const res = await getPhone({
|
||||||
|
code: code,
|
||||||
|
});
|
||||||
|
userInfo.value.phone = res.data.phone;
|
||||||
|
if (!res.data.phone)
|
||||||
|
return Taro.showToast({
|
||||||
|
title: '手机号获取失败',
|
||||||
|
icon: 'none',
|
||||||
|
});
|
||||||
|
Taro.login({
|
||||||
|
success: async res => {
|
||||||
|
Taro.setStorageSync('wx_code', res.code);
|
||||||
|
const ress = await login({
|
||||||
|
Code: Taro.getStorageSync('wx_code'),
|
||||||
|
Phone: userInfo.value.phone,
|
||||||
|
Referee: Taro.getStorageSync('bind_id'),
|
||||||
|
});
|
||||||
|
Taro.showToast({
|
||||||
|
title: `${ress.msg},请再次领取`,
|
||||||
|
icon: 'success',
|
||||||
|
});
|
||||||
|
Taro.setStorageSync('token', ress.data.token);
|
||||||
|
Taro.removeStorageSync('wx_code');
|
||||||
|
Taro.removeStorageSync('bind_id');
|
||||||
|
isLogin.value = true;
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
Taro.hideLoading();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss"></style>
|
||||||
4
src/pages/marketing/yq/index.config.ts
Normal file
4
src/pages/marketing/yq/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '',
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
});
|
||||||
32
src/pages/marketing/yq/index.scss
Normal file
32
src/pages/marketing/yq/index.scss
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
page {
|
||||||
|
background-image: url('https://pic.imgdb.cn/item/6697ab53d9c307b7e95e032c.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
width: 140px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-image: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
rgb(254, 43, 34) 0%,
|
||||||
|
rgb(255, 193, 0) 100%
|
||||||
|
);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stock {
|
||||||
|
width: 140px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 0.5px solid rgba(254, 46, 33, 1);
|
||||||
|
color: rgba(254, 46, 33, 1);
|
||||||
|
font-size: 24px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 40px;
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
||||||
128
src/pages/marketing/yq/index.vue
Normal file
128
src/pages/marketing/yq/index.vue
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<template>
|
||||||
|
<view class="flex flex-col items-center pt-[208px]">
|
||||||
|
<back />
|
||||||
|
<image
|
||||||
|
class="h-[600px] mb-[10px]"
|
||||||
|
src="https://pic.imgdb.cn/item/6697ac7bd9c307b7e95f3f39.png"
|
||||||
|
mode="scaleToFill" />
|
||||||
|
|
||||||
|
<view class="bg-white p-[20px] w-[700px] rounded-[20px]">
|
||||||
|
<view class="flex flex-col" v-if="data.length > 0">
|
||||||
|
<view class="mb-[20px] flex" v-for="(item, index) in data" :key="index">
|
||||||
|
<image
|
||||||
|
class="w-[200px] h-[200px] rounded-[10px] mr-[10px]"
|
||||||
|
:src="item.cover"
|
||||||
|
mode="scaleToFill" />
|
||||||
|
<view class="flex-1 flex flex-col justify-between">
|
||||||
|
<view>
|
||||||
|
<nut-ellipsis
|
||||||
|
direction="end"
|
||||||
|
:rows="2"
|
||||||
|
style="font-size: 20px"
|
||||||
|
:content="item.name"></nut-ellipsis>
|
||||||
|
<view class="flex items-center mt-[10px]">
|
||||||
|
<view class="tag">直播摇球机</view>
|
||||||
|
<view class="stock">剩余: {{ item.stock }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view
|
||||||
|
class="flex justify-between items-center bg-[#FEF3F1] rounded-full w-full h-[70px] pl-[20px]">
|
||||||
|
<view class="flex">
|
||||||
|
<view class="text-[#F83D3D] text-[28px] font-bold"
|
||||||
|
>{{ item.number }}元</view
|
||||||
|
>
|
||||||
|
<view class="text-[#F83D3D] text-[28px] font-bold ml-[20px]"
|
||||||
|
>{{ item.exchange }}积分</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<nut-button type="primary" size="small" @click="toPay(item)">
|
||||||
|
<view class="flex items-center">
|
||||||
|
<view class="pr-[5px] text-[28px]">购买</view>
|
||||||
|
<RectRight size="15" />
|
||||||
|
</view>
|
||||||
|
</nut-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<nut-empty v-else image="empty" description="暂时没有商品"></nut-empty>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {ref} from 'vue';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import {getHdOrJfGoods, createActiveOrder} from '@/api/goods';
|
||||||
|
import {getUserPoint} from '@/api/admin';
|
||||||
|
import {addCart} from '@/api/cart';
|
||||||
|
import Back from '@/components/Back.vue';
|
||||||
|
import {RectRight} from '@nutui/icons-vue-taro';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
const data = ref<any[]>([]);
|
||||||
|
|
||||||
|
Taro.useLoad(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
|
||||||
|
const page = ref({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
Taro.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
});
|
||||||
|
const res = await getHdOrJfGoods({
|
||||||
|
PageNum: page.value.page,
|
||||||
|
PageSize: page.value.pageSize,
|
||||||
|
type: 3,
|
||||||
|
});
|
||||||
|
data.value.push(...res.data.data);
|
||||||
|
page.value.itemCount = res.data.total;
|
||||||
|
Taro.hideLoading();
|
||||||
|
};
|
||||||
|
|
||||||
|
Taro.useReachBottom(() => {
|
||||||
|
if (page.value.page < Math.ceil(page.value.itemCount / page.value.pageSize)) {
|
||||||
|
page.value.page++;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const toPay = async item => {
|
||||||
|
console.log(item);
|
||||||
|
const tk = Taro.getStorageSync('token');
|
||||||
|
if (!tk) {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/users/login/index',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await addCart({
|
||||||
|
Bid: item.Store.bid,
|
||||||
|
Gid: item.gid,
|
||||||
|
Number: 1,
|
||||||
|
});
|
||||||
|
const user_info = Taro.getStorageSync('userInfo');
|
||||||
|
const data = await getUserPoint({
|
||||||
|
phone: user_info.data.phone,
|
||||||
|
bid: item.Store.bid,
|
||||||
|
});
|
||||||
|
|
||||||
|
const res = await createActiveOrder({
|
||||||
|
Bid: [item.Store.bid],
|
||||||
|
custID: data.data.store_user_id,
|
||||||
|
});
|
||||||
|
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/pages/goods/pay/index?oid=${res.data.oid}&bid=${item.Store.bid}&OrderType=1`,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss"></style>
|
||||||
Reference in New Issue
Block a user