feat(custom): build

This commit is contained in:
2023-11-28 17:59:45 +08:00
parent 22868fdf2c
commit d5c4651665
39 changed files with 5779 additions and 10624 deletions

View File

@@ -1,8 +1,10 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
import Taro from "@tarojs/taro";
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
// Taro.setStorageSync("token", "ok_OL66Ej4_lkQKNA0AwxnGwGyXo");
const tabValue = ref(1);
const tabsList = ref([
@@ -44,13 +46,22 @@ const tabChange = (index: number) => {
page.value.PageNum = 1;
};
const data = ref<any>([]);
interface DataType {
goods_name: string;
add_time: string;
number: number;
order_number: number;
type: number;
oid: string;
}
const data = ref<DataType[]>([]);
const userInfo = ref<any>({});
useLoad(() => {
Taro.useLoad(() => {
getList();
userInfo.value = getStorageSync("userInfo");
userInfo.value = Taro.getStorageSync("userInfo");
});
const page = ref({
@@ -84,7 +95,7 @@ const getList = async () => {
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
@@ -95,14 +106,14 @@ const getList = async () => {
<template>
<view>
<view class="card">
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
<!-- <view class="greeting">Hello! YuanHuakk</view>-->
<view class="info">
<view class="left">
<view>
<view class="num">豆子: {{ userInfo.pulse }}</view>
<view class="num">豆子: {{ userInfo.data?.pulse }}</view>
</view>
<view>
<view class="num">积分: {{ userInfo.integral }}</view>
<view class="num">积分: {{ userInfo.data?.integral }}</view>
</view>
</view>
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
@@ -123,13 +134,9 @@ const getList = async () => {
</view>
<view v-if="data.length > 0">
<view v-if="tabValue === 1 || tabValue === 3">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left">
<view>商品{{ item.goods_name }}</view>
<view>订单{{ item.oid }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
@@ -139,38 +146,29 @@ const getList = async () => {
</view>
<view v-if="tabValue === 3" style="color: red"
>+
<text>{{ item.number }} </text>
<text>{{ item.number }}</text>
积分
</view>
</view>
</view>
</view>
<view v-else-if="tabValue === 2">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left">
<view class="text">商品{{ item.goods_name }}</view>
<view>金额{{ item.order_number }}</view>
<view class="text">订单{{ item.oid }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }} </text>
<text>{{ item.number }}</text>
豆子
</view>
</view>
</view>
</view>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left">
<view class="text">类型{{ computerType(item.type) }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
@@ -178,7 +176,7 @@ const getList = async () => {
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }} </text>
<text>{{ item.number }}</text>
豆子
</view>
</view>

View File

@@ -1,16 +1,8 @@
<script lang="ts" setup>
import { ref } from "vue";
import {
useLoad,
useReachBottom,
showToast,
navigateTo,
setStorageSync,
useDidShow,
} from "@tarojs/taro";
import Taro from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
import { deleteJfOrder } from "@/api/goods";
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
import { getOrderStatistics } from "@/api/order";
const tabValue = ref(0);
@@ -51,40 +43,50 @@ interface OrderList {
oid: string;
add_time: string;
status: number;
BindGoods: {
cover: string;
name: string;
number: number;
};
OrderGoods: GoodsItem[];
count: number;
number: number;
pay_type: number;
exchange: number;
price: number;
}
interface GoodsItem {
Goods: {
name: string;
cover: string;
};
ID: number;
gid: string;
number: number;
oid: string;
pay_integral: number;
pay_price: number;
}
const orderList = ref<OrderList[]>([]);
useLoad((options) => {
Taro.useLoad((options) => {
tabValue.value = Number(options.type);
});
useDidShow(() => {
Taro.useDidShow(() => {
getList();
});
const getList = async () => {
try {
const res = await getIntegralOrderList({
const res = await getActiveOrderList({
status: tabValue.value,
});
console.log(res);
orderList.value = res.data.data;
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
}
getTj();
await getTj();
};
const tabChange = (index: number) => {
@@ -92,18 +94,18 @@ const tabChange = (index: number) => {
getList();
};
useReachBottom(() => {
Taro.useReachBottom(() => {
console.log("useReachBottom");
});
const openPay = (item: OrderList) => {
isShowPay.value = true;
jfInfo.value = [item];
jfInfo.value = item.oid;
};
const errPay = () => {
isShowPay.value = false;
showToast({
Taro.showToast({
title: "支付失败",
icon: "none",
});
@@ -112,7 +114,7 @@ const errPay = () => {
};
const closePay = () => {
isShowPay.value = false;
showToast({
Taro.showToast({
title: "支付取消",
icon: "none",
});
@@ -121,26 +123,32 @@ const closePay = () => {
};
const toDetail = (item: any) => {
setStorageSync("item", item);
navigateTo({
Taro.setStorageSync("item", item);
Taro.navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
});
};
const delOrder = async (oid: string) => {
try {
const res = await deleteJfOrder({ oid });
console.log(res);
await deleteActiveOrder({ oid });
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
}
getList();
await getList();
};
const countInfo = ref<any>({});
const countInfo = ref<{
A?: number;
B?: number;
C?: number;
D?: number;
F?: number;
Total?: number;
}>({});
const getTj = async () => {
try {
@@ -154,7 +162,7 @@ const getTj = async () => {
tabsList.value[3].num = countInfo.value.D || 0;
tabsList.value[4].num = countInfo.value.F || 0;
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
@@ -191,35 +199,40 @@ const getTj = async () => {
<view class="order-card" v-for="(item, index) in orderList" :key="index">
<view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}</view>
<view style="color: red"
>{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}
</view>
</view>
<view class="line"></view>
<view class="center">
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
<view class="top">
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods?.name }} </view>
<image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods?.name }}</view>
<view class="right">
<view>{{ item.BindGoods?.number }}</view>
<view>x{{ item?.count }}</view>
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view>
</view>
</view>
<!-- <view
class="bom"
style="text-align: right; font-size: 13px"
>
{{ item.count }}件商品,实付积分:
<text style="color: red">{{ item.number }}</text>
</view> -->
</view>
<view class="line"></view>
<view v-if="item.status !== 0" style="text-align: right">
<text>{{ item.count }}件商品</text>,
<text
>实付款:{{ item.pay_type === 1 ? item.price : item.exchange }},{{
item.pay_type === 1 ? "微信支付" : "积分支付"
}}</text
>
<view class="line"></view>
</view>
<view class="btn">
<nut-button
v-if="item.status === 0"
@@ -250,15 +263,22 @@ const getTj = async () => {
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="jf"
:interval="false"
:jfInfo="jfInfo"
:OrderType="2"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template>
<style lang="scss">
page {
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.topTips {
box-sizing: border-box;
width: 100%;
@@ -331,14 +351,16 @@ const getTj = async () => {
}
.center {
margin-bottom: 10px;
.top {
display: flex;
justify-content: space-between;
// align-items: flex-start;
image {
width: 150px;
height: 150px;
width: 150rpx;
height: 150rpx;
border-radius: 10rpx;
}
.title {

View File

@@ -19,12 +19,12 @@
<view class="mer-info">
<view class="left">
<view>
<text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore?.phone }}</text>
<text>{{ goodInfo.Store?.name }}</text>
<text>{{ goodInfo.Store?.phone }}</text>
</view>
<nut-ellipsis
:rows="2"
:content="goodInfo.BindStore?.address"
:content="goodInfo.Store?.address"
direction="end"
></nut-ellipsis>
</view>
@@ -45,12 +45,19 @@
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
<nut-cell>
<template #default>
<view class="top">
<image :src="goodInfo.BindGoods?.cover" />
<view class="title">{{ goodInfo.BindGoods?.name }} </view>
<view class="right">
<view>{{ goodInfo.BindGoods?.number }}</view>
<view>x{{ goodInfo.count }}</view>
<view class="center-box">
<view
class="top"
v-for="(item, index) in goodInfo.OrderGoods"
:key="index"
>
<image :src="item.Goods?.cover" />
<view class="title">{{ item.Goods?.name }} </view>
<view class="right">
<view>{{ item.pay_price }}</view>
<view>{{ item.pay_integral }}积分</view>
<view>x{{ item.number }}</view>
</view>
</view>
</view>
</template>
@@ -77,19 +84,20 @@
: '已失效'
"
></nut-cell>
<nut-cell
<!-- <nut-cell
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
:desc="goodInfo.number"
></nut-cell>
<nut-cell>
>
</nut-cell> -->
<nut-cell v-if="goodInfo.status !== 0">
<template #default>
<view style="text-align: right; width: 100%">
<view
>{{ goodInfo.status === 0 ? "应付款" : "实付款" }}({{
type === "1" ? "元" : "积分"
}}):
>实付款({{ goodInfo.pay_type === 1 ? "微信" : "积分" }})
<nut-price
:price="goodInfo.number"
:price="
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
"
size="normal"
:need-symbol="false"
/>
@@ -140,10 +148,11 @@
</nut-popup>
<pay
:isShowPay="isShowPay"
:payType="type === '1' ? 'wx' : 'jf'"
:interval="false"
:jfInfo="jfInfo"
:OrderType="2"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template>
@@ -197,14 +206,14 @@ Taro.useLoad((options) => {
const toPhone = () => {
Taro.makePhoneCall({
phoneNumber: goodInfo.value.BindStore.mobile,
phoneNumber: goodInfo.value.Store.mobile,
});
};
const toAdder = () => {
Taro.openLocation({
latitude: Number(goodInfo.value.BindStore.lat),
longitude: Number(goodInfo.value.BindStore.lon),
latitude: Number(goodInfo.value.Store.lat),
longitude: Number(goodInfo.value.Store.lon),
scale: 18,
});
};
@@ -214,6 +223,17 @@ const openPay = () => {
jfInfo.value = Taro.getStorageSync("item");
};
const successPay = (val: boolean) => {
isShowPay.value = val;
Taro.showToast({
title: "支付成功",
icon: "none",
});
Taro.navigateBack({
delta: 1,
});
};
const errPay = () => {
isShowPay.value = false;
Taro.showToast({
@@ -270,6 +290,7 @@ Taro.useUnload(() => {
<style lang="scss">
page {
--nut-cell-desc-color: #999;
height: 100vh;
box-sizing: border-box;
padding-bottom: 100px;
@@ -387,31 +408,39 @@ page {
align-items: flex-start;
}
.top {
width: 100%;
.center-box {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
width: 100%;
image {
width: 150px;
height: 150px;
}
.top {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
image {
width: 150px;
height: 150px;
border-radius: 10rpx;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
}

View File

@@ -6,8 +6,6 @@ import Upload from "@/components/Upload.vue";
const visible = ref(false);
const merType = ref(false);
const merGooType = ref(false);
// 验证码按钮文字
@@ -17,13 +15,30 @@ const smsStr = ref("获取验证码");
const smsDisabled = ref(false);
// 表单数据
const formValue = ref<any>({
const formValue = ref<{
name: string;
userName: string;
phone: string;
mobile: string;
code: string;
classId: string;
merGooTypeStr: string;
license: any[];
front: any[];
back: any[];
head_photo: any[];
img: any[];
bank: string;
bank_card: string;
bank_name: string;
bank_user: string;
address: string;
}>({
name: "",
userName: "",
phone: "",
mobile: "",
code: "",
bType: "",
merTypeStr: "",
classId: "",
merGooTypeStr: "",
license: [],
@@ -40,8 +55,6 @@ const formValue = ref<any>({
const merGooList = ref([]);
const merList = ref([]);
// 表单校验
const ruleForm = ref<any>(null);
@@ -53,19 +66,10 @@ Taro.useLoad(() => {
const getMerType = async () => {
try {
const res = await getMerTypeList();
console.log(res);
merList.value = res.data.type.map((item: any) => {
return {
text: item.name,
value: item.ID,
};
});
merGooList.value = res.data.class.map((item: any) => {
return {
text: item.name,
value: item.ID,
};
});
merGooList.value = res.data.class.map((item: any) => ({
text: item.name,
value: item.ID,
}));
} catch (e) {
Taro.showToast({
title: e.msg,
@@ -139,13 +143,6 @@ const getSmsCode = () => {
});
};
// 选择商户类型
const confirmMerType = (e: any) => {
formValue.value.merTypeStr = e.selectedOptions[0].text;
formValue.value.bType = e.selectedOptions[0].value;
merType.value = false;
};
// 选择经营类目
const confirmGooType = (e: any) => {
formValue.value.merGooTypeStr = e.selectedOptions[0].text;
@@ -357,33 +354,6 @@ const submit = () => {
placeholder="请输入银行卡号"
/>
</nut-form-item>
<nut-form-item
required
label="商户类型"
prop="merTypeStr"
:rules="[
{
required: true,
message: '请选择商户类型',
},
]"
>
<input
type="text"
:disabled="true"
v-model="formValue.merTypeStr"
placeholder="请选择商户类型"
@click="merType = true"
/>
<nut-popup position="bottom" v-model:visible="merType">
<nut-picker
:columns="merList"
title="商户类型"
@confirm="confirmMerType"
@cancel="merType = false"
></nut-picker>
</nut-popup>
</nut-form-item>
<nut-form-item
required
label="经营类目"
@@ -402,9 +372,14 @@ const submit = () => {
placeholder="请选择经营类目"
@click="merGooType = true"
/>
<nut-popup position="bottom" v-model:visible="merGooType">
<nut-popup
position="bottom"
v-model:visible="merGooType"
:safe-area-inset-bottom="true"
:catch-move="true"
>
<nut-picker
:columns="merGooList"
v-model:columns="merGooList"
title="商户类型"
@confirm="confirmGooType"
@cancel="merGooType = false"
@@ -494,8 +469,8 @@ const submit = () => {
<view class="btn">
<nut-button block type="primary" round @click="submit()"
>提交</nut-button
>
>提交
</nut-button>
</view>
</nut-form>
<!-- 入驻协议弹窗 -->

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import Taro from "@tarojs/taro";
import { ref } from "vue";
import { getPersonalInfo, editPersonalInfo, getPhone } from "@/api/user";
import { getPersonalInfo, editPersonalInfo } from "@/api/user";
import { View } from "@tarojs/components";
import { BASE_URL } from "@/utils/request";
@@ -10,7 +10,7 @@ import { BASE_URL } from "@/utils/request";
const userInfo = ref<any>({});
Taro.useLoad(() => {
const data = Taro.getStorageSync("userInfo");
const { data: data } = Taro.getStorageSync("userInfo");
userInfo.value = data;
});
@@ -72,17 +72,17 @@ const subUser = async () => {
}
};
const getUserInfo = async () => {
try {
const res = await getPersonalInfo();
userInfo.value = res.data.data;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
};
// const getUserInfo = async () => {
// try {
// const res = await getPersonalInfo();
// userInfo.value = res.data.data;
// } catch (error) {
// Taro.showToast({
// title: error.msg,
// icon: "none",
// });
// }
// };
</script>
<template>