This commit is contained in:
2023-10-08 22:53:13 +08:00
parent b883b02fb9
commit e36d60d015
83 changed files with 18303 additions and 9590 deletions

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '订单详情'
})

View File

@@ -0,0 +1,122 @@
<template>
<view>
<view class="header">
<view>订单号:{{ info.oid }}</view>
<view>{{ info.add_time }}</view>
</view>
<view class="good-info">
<view class="top">
<image :src="info.BindGoods?.cover" />
<view class="title">{{ info.BindGoods?.name }}</view>
</view>
<view class="public-total">
{{ info.count }}件商品已支付
<text class="money">{{ info.number }}</text>
</view>
</view>
<nut-cell-group>
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell>
<nut-cell
title="下单用户:"
:desc="info.BindUser?.nickName"
></nut-cell>
<nut-cell
title="用户手机号:"
:desc="info.BindUser?.phone"
></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人员:"
:desc="info.BindCancelUser?.nickName"
></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人手机号:"
:desc="info.BindCancelUser?.phone"
></nut-cell>
</nut-cell-group>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { ref, computed } from "vue";
const info = ref<any>({});
Taro.useLoad(() => {
info.value = Taro.getStorageSync("ver_order_info");
});
const orderStatus = computed(() => {
switch (info.value.status) {
case 1:
return "待核销";
case 2:
return "已核销";
case 3:
return "已失效";
}
});
</script>
<style lang="scss">
page {
--nut-cell-desc-color: #000;
}
.header {
background: linear-gradient(90deg, #2291f8 0, #1cd1dc);
padding: 30px;
color: #fff;
font-size: 30px;
}
.user-info {
background-color: #fff;
width: 100%;
}
.good-info {
margin-top: 20px;
width: 100%;
background-color: #fff;
padding: 20px;
.top {
display: flex;
justify-content: space-between;
align-items: flex-start;
image {
width: 200px;
height: 200px;
}
.title {
flex: 1;
padding: 10px;
}
.price {
text-align: right;
}
}
.public-total {
font-size: 28px;
color: #282828;
border-top: 1px solid #eee;
height: 92px;
line-height: 92px;
text-align: right;
padding: 0 30px;
background-color: #fff;
}
.public-total .money {
color: #ff4c3c;
}
}
</style>

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '订单管理'
})

View File

@@ -0,0 +1,237 @@
<template>
<view>
<view class="Card">
<view>全部订单</view>
<view class="orderinfo">
<view class="info" @click="toListPage(0)">
<view class="num">{{ orderInfo?.count?.A || 0 }}</view>
<view class="sub">全部</view>
</view>
<view class="info" @click="toListPage(1)">
<view class="num">{{ orderInfo?.count?.B || 0 }}</view>
<view class="sub">待付款</view>
</view>
<view class="info" @click="toListPage(2)">
<view class="num">{{ orderInfo?.count?.C || 0 }}</view>
<view class="sub">待核销</view>
</view>
<view class="info" @click="toListPage(3)">
<view class="num">{{ orderInfo?.count?.D || 0 }}</view>
<view class="sub">已核销</view>
</view>
<view class="info" @click="toListPage(4)">
<view class="num">{{ orderInfo?.count?.F || 0 }}</view>
<view class="sub">已过期</view>
</view>
</view>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-shujutongji icon"></text
><text>数据统计</text></view
>
<view class="gridBox">
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=today`"
>
<view class="title">{{
orderInfo?.total?.TodayNumber || 0
}}</view>
<view class="sub">今日成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=yesterday`"
>
<view class="title">{{
orderInfo?.total?.YesterdayNumber || 0
}}</view>
<view class="sub">昨日成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=month`"
>
<view class="title">{{
orderInfo?.total?.MonthNumber || 0
}}</view>
<view class="sub">本月成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=today`"
>
<view class="title">{{
orderInfo?.total?.TodayOrder || 0
}}</view>
<view class="sub">今日订单数</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=yesterday`"
>
<view class="title">{{
orderInfo?.total?.YesterdayOrder || 0
}}</view>
<view class="sub">昨日订单数</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=month`"
>
<view class="title">{{
orderInfo?.total?.MonthOrder || 0
}}</view>
<view class="sub">本月订单数</view>
</navigator>
</view>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-xiangxishuju icon"></text
><text>详细数据</text></view
>
<view v-if="orderInfo?.list?.length > 0">
<nut-table
:bordered="true"
class="table"
:columns="columns"
:data="orderInfo?.list"
></nut-table>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
</view>
</view>
</template>
<script lang="ts" setup>
import { h, ref } from "vue";
import Taro from "@tarojs/taro";
import { orderStatistics } from "../../../api/admin";
Taro.useLoad(() => {
getData();
});
const orderInfo = ref<any>({});
const columns = ref([
{
title: "日期",
key: "Date",
align: "center",
},
{
title: "订单数",
key: "TotalCount",
align: "center",
},
{
title: "交易额",
key: "NumberSum",
align: "center",
render: (row) => {
return h(
"view",
{
style: {
color: "red",
},
},
row.NumberSum
);
},
},
]);
const getData = async () => {
const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo");
const res = await orderStatistics({
bid: user_info.bid,
type: mer_type,
});
orderInfo.value = res.data;
};
const toListPage = (index: number) => {
Taro.navigateTo({
url: `/pages/admin/order_manage/list/index?type=${index}`,
});
};
</script>
<style lang="scss">
.Card {
width: 90%;
background-color: #fff;
border-radius: 10px;
margin: 10px auto;
padding: 25px;
.top {
display: flex;
align-items: center;
text {
margin-right: 5px;
}
}
}
.icon {
color: red;
}
.gridBox {
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(3, 33.33%);
grid-template-rows: repeat(3, 33.33%);
grid-gap: 10px;
justify-content: center;
text-align: center;
.item {
margin-top: 50px;
.title {
font-size: 50px;
}
.sub {
font-size: 25px;
color: #999;
}
}
}
.table {
margin-top: 10px;
}
.orderinfo {
display: flex;
justify-content: space-between;
margin-top: 20px;
align-items: center;
.info {
text-align: center;
.num {
font-size: 40px;
color: red;
}
.sub {
font-size: 25px;
color: #999;
}
}
}
</style>

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '订单列表'
})

View File

@@ -0,0 +1,225 @@
<template>
<view>
<view class="tabs">
<view
class="item"
v-for="item in opt"
:key="item.value"
@click="tabChange(item.value)"
>
<view class="title">{{ item.text }}</view>
<view
class="line"
:style="{
backgroundColor: item.value === tabVal ? 'red' : '',
}"
></view>
</view>
</view>
<view v-if="dataList.length > 0">
<view
class="order-card"
v-for="(item, index) in dataList"
:key="index"
@click="toDetailPage(item)"
>
<view class="top">
<view class="name">订单号:{{ item.oid }}</view>
<!-- <view class="sub">下单时间{{ item.add_time }}</view> -->
<view class="sub"
>核销时间{{ item.cancel_time || "待核销" }}</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="top">
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view>
<view class="right">
<view>{{ item.number }}</view>
<view>x{{ item.count }}</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>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import Taro from "@tarojs/taro";
import { getJfOrderList, getActiveOrderList } from "../../../../api/admin";
const opt = ref([
{
text: "全部",
value: 0,
},
{
text: "待付款",
value: 1,
},
{
text: "待核销",
value: 2,
},
{
text: "已核销",
value: 3,
},
{
text: "已失效",
value: 4,
},
]);
const tabVal = ref(0);
const dataList = ref<any>([]);
Taro.useLoad((options) => {
tabVal.value = Number(options.type);
getData();
});
const getData = async () => {
try {
const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo");
let res: any = null;
const data = {
bid: user_info.bid,
status: tabVal.value,
};
if (mer_type === 1) {
res = await getActiveOrderList(data);
} else {
res = await getJfOrderList(data);
}
dataList.value = res.data.data;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
};
const tabChange = (e: number) => {
tabVal.value = e;
getData();
};
const toDetailPage = (item: any) => {
Taro.setStorageSync("ver_order_info", item);
Taro.navigateTo({
url: "/pages/admin/order_manage/detail/index",
});
};
</script>
<style lang="scss">
.tabs {
display: flex;
justify-content: space-evenly;
align-items: center;
background-color: #fff;
padding: 10px;
.item {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
.line {
margin-top: 10px;
width: 50px;
height: 5px;
}
}
}
.order-card {
width: 95%;
box-sizing: border-box;
margin: 15px auto;
background-color: #fff;
border-radius: 10px;
padding: 20px;
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px;
}
.top {
// display: flex;
// justify-content: space-between;
// align-items: center;
.name {
font-weight: bold;
}
.sub {
color: #999;
font-size: 30px;
}
}
.btn {
display: flex;
justify-content: flex-end;
align-items: center;
}
.center {
.top {
display: flex;
justify-content: space-between;
// align-items: flex-start;
image {
width: 150px;
height: 150px;
}
.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;
}
}
}
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "订单数据统计",
});

View File

@@ -0,0 +1,454 @@
<template>
<view class="statistical-page" ref="container">
<view class="navs">
<view class="list">
<view
class="item"
:class="time == 'today' ? 'on' : ''"
@click="setTime('today')"
>
今天
</view>
<view
class="item"
:class="time == 'yesterday' ? 'on' : ''"
@click="setTime('yesterday')"
>
昨天
</view>
<view
class="item"
:class="time == 'seven' ? 'on' : ''"
@click="setTime('seven')"
>
最近7天
</view>
<view
class="item"
:class="time == 'month' ? 'on' : ''"
@click="setTime('month')"
>
本月
</view>
<view
class="item"
:class="time == 'date' ? 'on' : ''"
@click="dateTitle"
>
自定义
</view>
</view>
</view>
<view class="wrapper">
<view class="title">
{{ title }}{{ where.type == 1 ? "营业额" : "订单量" }}
</view>
<view v-if="where.type == 1" class="money">{{
dataObj.all || 0
}}</view>
<view v-else class="money">{{ dataObj.all || 0 }}</view>
<view class="increase">
<view>
{{ time === "date" ? "" : title }}增长率<text
:class="dataObj.growthRate >= 0 ? 'red' : 'green'"
>
{{ dataObj.growthRate }}%
<text
class="iconfont"
:class="
dataObj.growthRate >= 0
? 'icon-xiangshang1'
: 'icon-xiangxia2'
"
></text
></text>
</view>
<view>
{{ time === "date" ? "" : title }}增长<text
:class="dataObj.growthNumber >= 0 ? 'red' : 'green'"
>{{ dataObj.growthNumber }}
<text
class="iconfont"
:class="
dataObj.growthNumber >= 0
? 'icon-xiangshang1'
: 'icon-xiangxia2'
"
></text
></text>
</view>
</view>
</view>
<view class="chart">
<canvas
canvas-id="myChart"
style="width: 100%; height: 250px"
:ontouch="true"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
/>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-xiangxishuju icon"></text
><text>详细数据</text></view
>
<view v-if="dataObj?.list?.length > 0">
<nut-table
:bordered="true"
class="table"
:columns="columns"
:data="dataObj?.list"
></nut-table>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
</view>
<!-- 日期选择 -->
<nut-calendar
v-model:visible="isVisible"
type="range"
:start-date="date_start"
@close="isVisible = false"
@choose="setChooseValue"
>
</nut-calendar>
</view>
</template>
<script setup lang="ts">
import { ref, computed, h } from "vue";
import Taro from "@tarojs/taro";
import { growthRate } from "../../../api/admin";
import dayjs from "dayjs";
import uCharts from "../../../utils/js_sdk/u-charts.min.js";
const time = ref("");
const isVisible = ref(false);
let canvas_obj;
const w = Taro.getSystemInfoSync().windowWidth;
const chartWH = ref({
width: w * 0.9,
height: 250,
pixelRatio: 1,
});
const columns = ref([
{
title: "日期",
key: "Date",
align: "center",
},
{
title: "订单数",
key: "TotalCount",
align: "center",
},
{
title: "交易额",
key: "NumberSum",
align: "center",
render: (row) => {
return h(
"view",
{
style: {
color: "red",
},
},
row.NumberSum
);
},
},
]);
const date_start = computed(() => {
return dayjs().startOf("year").format("YYYY-MM-DD");
});
const title = ref("");
const where = ref({
type: 1,
status: 2,
start: "",
end: "",
});
const dataObj = ref<any>({});
const opts = ref<any>({
categories: [],
series: [
{
name: "营业额",
data: [],
},
{
name: "订单量",
data: [],
},
],
});
Taro.useLoad((options) => {
where.value.type = options.type === "price" ? 1 : 2;
time.value = options.time;
setTime(options.time);
// getData();
});
const setTime = (type: string) => {
time.value = type;
switch (type) {
case "today":
title.value = "今日";
where.value.status = 2;
where.value.start = dayjs().format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD");
break;
case "yesterday":
title.value = "昨日";
where.value.status = 2;
where.value.start = dayjs().add(-1, "day").format("YYYY-MM-DD");
where.value.end = dayjs().add(-1, "day").format("YYYY-MM-DD");
break;
case "seven":
title.value = "7天";
where.value.status = 2;
where.value.start = dayjs().add(-6, "day").format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD");
break;
case "month":
title.value = "本月";
where.value.status = 1;
where.value.start = dayjs().startOf("month").format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD");
break;
}
getData();
};
const dateTitle = () => {
where.value.status = 1;
time.value = "date";
isVisible.value = true;
};
const setChooseValue = (ref: any) => {
where.value.start = ref[0][3];
where.value.end = ref[1][3];
title.value = `${where.value.start}-${where.value.end}`;
getData();
};
const getData = async () => {
try {
const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo");
const res = await growthRate({
bid: user_info.bid,
type: mer_type,
status: where.value.status,
StartTime: where.value.start,
EndTime: where.value.end,
});
dataObj.value = res.data;
opts.value.categories = [];
opts.value.series[0].data = [];
opts.value.series[1].data = [];
res.data.list.forEach((item: any) => {
opts.value.categories.push(item.Date);
opts.value.series[0].data.push(item.NumberSum);
opts.value.series[1].data.push(item.TotalCount);
});
create_canvas();
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
throw error;
}
};
const create_canvas = () => {
const ctx = Taro.createCanvasContext("myChart");
canvas_obj = new uCharts({
type: "column",
context: ctx,
width: chartWH.value.width,
height: chartWH.value.height,
categories: opts.value.categories,
series: opts.value.series,
pixelRatio: chartWH.value.pixelRatio,
animation: true,
background: "#FFFFFF",
color: [
"#1890FF",
"#91CB74",
"#FAC858",
"#EE6666",
"#73C0DE",
"#3CA272",
"#FC8452",
"#9A60B4",
"#ea7ccc",
],
padding: [15, 15, 0, 15],
enableScroll: true,
legend: {},
xAxis: {
disableGrid: true,
scrollShow: true,
itemCount: 3,
},
yAxis: {
data: [
{
min: 0,
},
],
},
extra: {
column: {
type: "group",
width: 20,
activeBgColor: "#000000",
activeBgOpacity: 0.08,
},
},
});
};
const touchStart = (e: any) => {
canvas_obj.showToolTip(e, {
format: function (item: any, category: any) {
return category + " " + item.name + ":" + item.data;
},
});
canvas_obj.scrollStart(e);
};
const touchMove = (e: any) => {
canvas_obj.scroll(e);
};
const touchEnd = (e: any) => {
canvas_obj.scrollEnd(e);
};
</script>
<style lang="scss">
.statistical-page {
.navs {
width: 100%;
height: 96px;
background-color: #fff;
overflow: hidden;
line-height: 96px;
position: fixed;
top: 0;
left: 0;
z-index: 9;
.list {
overflow-y: hidden;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
width: 100%;
.item {
font-size: 32px;
color: #282828;
margin-left: 60px;
display: inline-block;
}
.on {
color: #fa2c19;
}
}
}
.wrapper {
width: 95%;
background-color: #fff;
border-radius: 10px;
margin: 119px auto 0 auto;
padding: 50px 60px;
.title {
font-size: 30px;
color: #999;
text-align: center;
}
.money {
font-size: 72px;
color: #fba02a;
text-align: center;
margin-top: 10px;
}
.increase {
font-size: 28px;
color: #999;
margin-top: 20px;
display: flex;
justify-content: space-between;
align-items: center;
.red {
color: #ff6969;
}
.green {
color: #1abb1d;
}
.iconfont {
font-size: 23px;
margin-left: 15px;
}
}
}
.chart {
width: 95%;
box-sizing: border-box;
background-color: #fff;
border-radius: 10px;
margin: 23px auto;
padding: 10px;
}
.Card {
width: 95%;
background-color: #fff;
border-radius: 10px;
margin: 10px auto;
padding: 25px;
.top {
display: flex;
align-items: center;
text {
margin-right: 5px;
}
.iconfont {
color: #fa2c19;
}
}
.table {
margin-top: 10px;
}
}
}
</style>

View File

@@ -10,7 +10,6 @@
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { orderVerify, activeOrderVerify } from "@/api/admin";
// url参数转对象
// const urlParse = (url: string) => {
@@ -35,20 +34,8 @@ const scanCode = () => {
success: async (res) => {
try {
const mer_type = JSON.parse(Taro.getStorageSync("mer_type"));
let data;
if (mer_type === 1) {
data = await activeOrderVerify({
oid: res.result,
});
} else {
data = await orderVerify({
oid: res.result,
});
}
Taro.showToast({
title: data.msg,
icon: "none",
Taro.navigateTo({
url: `/pages/admin/verify/verify_list/index?oid=${res.result}&mer_type=${mer_type}`,
});
} catch (error) {
Taro.showToast({

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "核销列表",
});

View File

@@ -0,0 +1,146 @@
<template>
<view>
<view class="card">
<view>订单号{{ goodInfo.oid }}</view>
<view class="line"></view>
<view class="container">
<image
class="image"
:src="goodInfo.cover"
mode="widthFix"
></image>
<view class="info">
<view class="title">{{ goodInfo.goods_name }}</view>
<view class="num"
>数量:
<text style="color: red">{{
goodInfo.count
}}</text></view
>
</view>
<view></view>
</view>
<view class="line"></view>
<view class="cz">
<nut-button size="small" type="primary" @click="subVerify"
>确定核销</nut-button
>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import {
getJfVerifyList,
getActiveVerifyList,
activeOrderVerify,
orderVerify,
} from "@/api/admin";
import { ref } from "vue";
const opt = ref<any>({});
Taro.useLoad((options) => {
opt.value = options;
getData(options);
});
const goodInfo = ref<any>({});
const getData = async (options: any) => {
let res;
if (Number(options.mer_type) === 1) {
res = await getActiveVerifyList({
oid: options.oid,
});
} else {
res = await getJfVerifyList({
oid: options.oid,
});
}
if (!res.data.data.oid) {
Taro.showToast({
title: "没有此订单",
icon: "none",
});
setTimeout(() => {
Taro.navigateBack({
delta: 1,
});
}, 3000);
}
goodInfo.value = res.data.data;
};
const subVerify = async () => {
try {
let res;
if (Number(opt.value.mer_type) === 1) {
res = await activeOrderVerify({
oid: goodInfo.value.oid,
});
} else {
res = await orderVerify({
oid: goodInfo.value.oid,
});
}
Taro.showToast({
title: res.msg,
icon: "none",
});
setTimeout(() => {
Taro.navigateBack({
delta: 1,
});
}, 3000);
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
throw error;
}
};
</script>
<style lang="scss">
.card {
padding: 20rpx;
background-color: #fff;
margin: 10px auto;
width: 90%;
border-radius: 7px;
.container {
display: flex;
image {
width: 200px;
height: 100%;
border-radius: 7px;
display: block;
}
.info {
margin-left: 20px;
}
.title {
margin-bottom: 10px;
}
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
}
.cz {
text-align: right;
}
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "收益提现",
});

View File

@@ -1,15 +1,197 @@
<script lang="ts">
import {defineComponent} from 'vue'
<script lang="ts" setup>
import {ref, h} from 'vue'
import Taro from '@tarojs/taro'
import {getWithdrawList, addWithdraw} from '@/api/admin'
export default defineComponent({
name: "index"
const user_info = Taro.getStorageSync('userInfo')
const row = ref(0)
const basicData = ref({
num: ''
})
const showPreview = ref(false)
const imgData = ref([{
src: ''
}])
const columns = ref([
{
title: '时间',
key: 'add_time',
align: 'center'
}, {
title: '提现金额',
key: 'integral',
align: 'center',
render: (row: { integral: number; }) => {
return h('view', {}, row.integral / 100)
}
},
{
title: '审核状态',
key: 'status',
align: 'center',
render: (row: { status: number; }) => {
return h('view', {
class: `tag ${row.status === 1 ? 'success' : row.status === 2 ? 'danger' : 'warning'}`
}, {
default: () => row.status === 1 ? '已打款' : row.status === 2 ? '已拒绝' : '待审核'
})
}
},
{
title: '备注',
key: 'img',
align: 'center',
render: (row: { status_img: string; }) => {
return h('img', {
class: 'image',
onClick: () => {
imgData.value[0].src = row.status_img
showPreview.value = true
},
src: row.status_img
})
}
}
])
const data = ref([])
const pagination = ref({
page: 1,
itemsPerPage: 5,
showPageSize: 5,
totalItems: 0,
change: (page: number) => {
pagination.value.page = page
getData()
}
})
const hideFn = () => {
showPreview.value = false
}
Taro.useLoad(() => {
getData()
})
const getData = async () => {
try {
const res = await getWithdrawList({
PageNum: pagination.value.page,
PageSize: pagination.value.showPageSize,
Bid: user_info.bid
})
data.value = res.data.data || []
pagination.value.totalItems = res.data.total
row.value = res.data.integral || 0
console.log(res)
} catch (e) {
throw e
}
}
const add = async () => {
try {
if (Number(basicData.value.num) === 0) return Taro.showToast({
title: '提现积分需大于0',
icon: 'none'
})
const res = await addWithdraw({
Bid: user_info.bid,
Number: Number(basicData.value.num)
})
Taro.showToast({
title: res.msg,
icon: 'none'
})
await getData()
} catch (e) {
throw e
}
}
</script>
<template>
$END$
<view>
<nut-form>
<nut-form-item label="提现积分:">
<nut-input v-model="basicData.num" class="nut-input-text" placeholder="请输入提现积分" type="text"/>
</nut-form-item>
<nut-form-item>
<view>
当前可提现积分
<text class="text-red">{{ row }}</text>
</view>
<view style="margin-top: 10px">
实际到账
<text class="text-red">{{ (row / 100).toFixed(2) }}</text>
</view>
</nut-form-item>
<nut-form-item>
<nut-button block type="primary" @click="add">立即提现</nut-button>
</nut-form-item>
</nut-form>
<view v-if="data.length > 0">
<view class="data">
<nut-table :columns="columns" :data="data"></nut-table>
<nut-pagination class="pagination" v-model="pagination.page" :total-items="pagination.totalItems"
:items-per-page="pagination.itemsPerPage" :show-page-size="pagination.showPageSize"
@change="pagination.change" :bordered="false"/>
</view>
</view>
<nut-empty v-else description="暂无提现记录"></nut-empty>
<!-- 图片预览 -->
<nut-image-preview :show="showPreview" :images="imgData" @close="hideFn"/>
</view>
</template>
<style scoped lang="scss">
<style lang="scss">
.text-red {
color: red;
}
.data {
display: flex;
flex-direction: column;
justify-content: center;
background-color: #fff;
padding: 10px;
.pagination {
margin: 10px auto;
}
}
.tag {
width: 100%;
padding: 5px 8px;
color: white;
border-radius: 8px;
margin: 0 auto;
}
.success {
background-color: #4fc08d;
}
.danger {
background-color: #df3526;
}
.warning {
background-color: #f3812e;
}
.image {
width: 50px;
height: 50px;
}
</style>

View File

@@ -3,21 +3,58 @@
style="height: 100vh"
v-model="val"
title-scroll
name="tab4value"
ellipsis
:animated-time="10"
name="tabs"
direction="vertical"
@change="tabChange"
>
<nut-tab-pane v-for="item in list" :title="(item.name as string)">
Tab {{ item.name }}</nut-tab-pane
<nut-tab-pane
v-for="item in list"
:title="(item.name as string)"
:key="item.ID"
>
<view v-if="goodList.length > 0">
<view
class="list"
v-for="(item, index) in (goodList as any)"
:key="index"
>
<view class="item">
<img :src="item.cover" />
<view class="right">
<view class="name">{{ item.name }}</view>
<view class="bom">
<view class="price"
><text style="font-size: 15px">{{
item.number
}}</text>
积分</view
>
<nut-button
size="mini"
type="primary"
@click.stop="
toGoodDetails(item.gid as number)
"
>去兑换</nut-button
>
</view>
</view>
</view>
</view>
</view>
<nut-empty v-else description="暂无商品"></nut-empty>
</nut-tab-pane>
</nut-tabs>
</template>
<script lang="ts" setup>
import Taro from "@tarojs/taro";
import { ref } from "vue";
import { getCategoryList } from "@/api/goods";
import { getCategoryList, getCategoryGoods } from "@/api/goods";
const val = ref("0");
const val = ref(0);
interface List {
ID?: number;
@@ -26,18 +63,82 @@ interface List {
const list = ref<Array<List>>([]);
Taro.useLoad(() => {
getGoodsType();
console.log("load");
});
const goodList = ref([]);
Taro.useDidShow(() => {});
Taro.useDidShow(() => {
getGoodsType();
});
// 获取商品分类
const getGoodsType = async () => {
const res = await getCategoryList();
list.value = res.data.data;
getData(list.value[val.value].ID as number);
};
const getData = async (id: number) => {
const res = await getCategoryGoods({
class_id: id,
});
goodList.value = res.data.data;
};
const tabChange = async () => {
getData(list.value[val.value].ID as number);
};
const toGoodDetails = (gid: number) => {
Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${gid}`,
});
};
</script>
<style lang="scss"></style>
<style lang="scss">
.list {
.item {
display: flex;
margin-bottom: 10px;
img {
width: 140px;
height: 140px;
border-radius: 10px;
}
.right {
flex: 1;
margin-left: 5px;
display: flex;
flex-direction: column;
justify-content: center;
// text-align: right;
.name {
// height: 20px;
font-size: 28px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-word;
}
.bom {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-top: 10px;
.price {
font-size: 20px;
font-weight: bold;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
}
}
</style>

View File

@@ -6,59 +6,14 @@
<script setup lang="ts">
import { ref } from "vue";
import { useLoad } from "@tarojs/taro";
// const listVal = ref<any>([]);
import { useLoad, getStorageSync } from "@tarojs/taro";
const url = ref("");
useLoad((options) => {
console.log(options);
// getList();
url.value = `https://www.jdt168.com/public/#/pages/index/index?uid=${options.uid}`;
console.log(url.value);
useLoad(() => {
const user = getStorageSync("userInfo");
url.value = `${process.env.TARO_APP_GAME}${user.uid}`;
});
// const getList = () => {
// for (let i = 0; i < 1; i++) {
// setTimeout(() => {
// listVal.value.push({
// id: i,
// status: true,
// });
// }, 50 * i);
// }
// };
// const toDetails = (id: string) => {
// navigateTo({
// url: "/pages/game/gamedetail/index?id=" + id,
// });
// };
</script>
<style lang="scss">
.list-box {
background-color: #fff;
border-radius: 15rpx;
width: 630rpx;
height: 200rpx;
margin: 20rpx auto;
padding: 30rpx;
font-size: 45rpx;
}
.listBoxAnim {
animation: 0.5s leftAnim;
}
@keyframes leftAnim {
from {
transform: translateX(110%);
}
to {
transform: translateX(0);
}
}
</style>
<style lang="scss"></style>

View File

@@ -12,9 +12,10 @@ import { WebView } from "@tarojs/components";
const gameUrl = ref("");
const user = getStorageSync("userInfo");
const user = ref({})
useLoad(() => {
user.value = getStorageSync("userInfo");
console.log(user);
});
</script>

View File

@@ -27,8 +27,8 @@
:symbol="payType === 'jf' ? '积分' : '元'"
/>
</view>
<view class="title">{{ goodInfo.name }} </view>
<view class="sub">{{ goodInfo.profile }} </view>
<view class="title">{{ goodInfo.name }}</view>
<view class="sub">{{ goodInfo.profile }}</view>
</view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 -->
@@ -40,7 +40,6 @@
:nodes="goodInfo.details"
></rich-text>
<nut-empty v-else description="暂无产品介绍"></nut-empty>
</view>
<view style="height: 9vh"></view>
<!-- 底部 -->
@@ -50,33 +49,30 @@
<Home />
<view>首页</view>
</view>
<view
class="icon"
v-if="payType === 'jf'"
@click="toPage('/pages/cart/index')"
>
<Cart />
<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>
<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()"
<view style="width: 80%">
<!-- <nut-button-->
<!-- v-if="payType === 'jf'"-->
<!-- style="margin-right: 10px"-->
<!-- type="warning"-->
<!-- @click="add_cart()"-->
<!-- >加入购物车-->
<!-- </nut-button>-->
<nut-button type="primary" block @click="toOrderDetail()"
>{{ payType === "jf" ? "立即兑换" : "立即购买" }}
</nut-button>
</view>
@@ -99,6 +95,7 @@
<nut-input-number
v-model="count"
@change="addCount"
button-size="30"
/>
</template>
</nut-cell>
@@ -126,11 +123,16 @@
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 {
Left,
Home,
// Cart,
My,
} from "@nutui/icons-vue-taro";
import {
getGoodsDetail,
getActiveGoodsDetail,
addCart,
// addCart,
createOrder,
createActiveOrder,
} from "@/api/goods";
@@ -178,11 +180,12 @@ const get_good_detail = async (gid: string) => {
} else {
res = await getActiveGoodsDetail({ gid: gid });
}
goodInfo.value = res.data.data;
goodInfo.value = {
...res.data.data,
// details: res.data.data.details.,
};
swiperList.value = res.data.data.rotation.split(",");
console.log(goodInfo.value);
} catch (e) {
Taro.showToast({
title: e.msg,
@@ -221,25 +224,40 @@ const openSku = () => {
// const selectSku = () => {};
// const clickBtnOperate = () => {};
// const close = () => {};
const add_cart = async () => {
if (isSkuShow.value === false) return openSku();
try {
await addCart({ gid: goodInfo.value.gid });
Taro.showToast({
title: "加入购物车成功",
icon: "success",
duration: 2000,
});
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
isSkuShow.value = false;
};
// const add_cart = async () => {
// if (isSkuShow.value === false) return openSku();
// try {
// await addCart({ gid: 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 (!Taro.getStorageSync("token")) {
return Taro.showModal({
title: "提示",
content: "你还没登录,请先登录",
cancelText: "先逛逛",
confirmText: "去登录",
success: (res) => {
if (res.confirm) {
Taro.reLaunch({
url: "/pages/users/login/index",
});
}
},
});
}
if (isSkuShow.value === false) return openSku();
// Taro.navigateTo({
// url: '/pages/goods/order_create/index'
@@ -260,7 +278,7 @@ const toOrderDetail = async () => {
});
}
orderData.value = res.data.data;
orderData.value = res?.data?.data;
isShowPay.value = true;
@@ -298,6 +316,12 @@ const toPage = (url: string, type: number = 1) => {
</script>
<style lang="scss">
page {
--nut-cell-box-shadow: none;
// --nut-cell-padding: 0;
--nut-cell-title-font: 30px;
}
// sku遮罩
.overlay {
background-color: rgba(0, 0, 0, 0.5);
@@ -311,12 +335,7 @@ const toPage = (url: string, type: number = 1) => {
position: fixed;
left: 30px;
top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114px;
/* #endif */
}
.head-menu {
@@ -337,7 +356,7 @@ const toPage = (url: string, type: number = 1) => {
.nut-swiper-item img {
width: 100%;
height: 550px;
height: 730px;
}
.card {
@@ -371,13 +390,12 @@ const toPage = (url: string, type: number = 1) => {
}
.rich {
box-sizing: border-box;
// &[img] {
// max-width: 100%;
// }
width: 100%;
// &[alt] {
// max-width: 100%;
// img {
// width: 100%;
// height: auto;
// display: block;
// }
}
}
@@ -395,8 +413,9 @@ const toPage = (url: string, type: number = 1) => {
.bottom-box {
border-top: 1px solid #e5e5e585;
position: fixed;
box-sizing: border-box;
bottom: 0;
height: 5.5vh;
height: 150rpx;
background: #fff;
display: flex;
justify-content: space-between;
@@ -405,7 +424,7 @@ const toPage = (url: string, type: number = 1) => {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
width: 100vw;
width: 100%;
.left {
display: flex;

View File

@@ -46,6 +46,7 @@ const tabsList = ref([
const jfInfo = ref({});
interface OrderList {
oid: string;
add_time: string;
status: number;
BindGoods: {
@@ -222,7 +223,7 @@ const delOrder = async (oid: string) => {
<view class="title">{{ item.BindGoods.name }} </view>
<view class="right">
<view>{{ item.number }}</view>
<view>x{{ item.count }}</view>
<!-- <view>x{{ item.count }}</view> -->
</view>
</view>
<!-- <view

View File

@@ -20,7 +20,7 @@
</view>
</view>
<!-- 商品列表 -->
<view class="goodBox">
<!-- <view class="goodBox">
<view
class="good"
v-for="item in list"
@@ -41,37 +41,97 @@
</view>
</view>
</view>
</view> -->
<view class="goodBox">
<view
class="good"
v-for="item in (merdata as any)"
:key="item.ID"
@click.stop="toMerDetails(item)"
>
<image :src="(item.head_photo as string)" />
<view class="good-text-box">
<text class="good-text">{{ item.name }}</text>
<text style="color: #999"
>距离我{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(item.lat),
Number(item.lon)
)
}}</text
>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { useLoad, navigateTo } from "@tarojs/taro";
import { getActiveGoods } from "../../../api/goods";
import Taro from "@tarojs/taro";
import {
// getActiveGoods,
getMerList,
} from "../../../api/goods";
import { IconFont } from "@nutui/icons-vue-taro";
import { calculateDistance } from "@/utils";
const list = ref<any>([]);
// const list = ref<any>([]);
useLoad(() => {
getList();
Taro.useLoad(() => {
// getList();
get_mer_list();
});
const getList = async () => {
const res = await getActiveGoods();
console.log(res);
list.value = res.data.data;
};
// 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`,
// const toGoodDetails = (id: number) => {
// Taro.navigateTo({
// url: `/pages/goods/goods_detail/index?gid=${id}&type=1`,
// });
// };
const hotGoodsDetail = () => {
Taro.navigateTo({
url: `/pages/hotGoods/hot_list/index`,
});
};
const hotGoodsDetail = () => {
navigateTo({
url: `/pages/hotGoods/hot_list/index`,
const merdata = ref([]);
const userLocalNum = ref({
l: 0,
t: 0,
});
const get_mer_list = async () => {
Taro.getLocation({
type: "wgs84",
success: (res) => {
userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude;
},
});
const res = await getMerList({
PageNum: 1,
PageSize: 10,
Btype: 1,
classid: 0,
});
merdata.value = res.data.data;
};
const toMerDetails = (item: any) => {
Taro.setStorageSync("mer_info", item);
Taro.navigateTo({
url: `/pages/mer/mer_detail/index`,
});
};
</script>

View File

@@ -1,3 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '首页',
navigationBarTitleText: '首页',
enableShareAppMessage: true
})

View File

@@ -30,9 +30,9 @@
</nut-grid>
</view>
<!-- 标题 -->
<view class="titleImg">为你推荐</view>
<!-- <view class="titleImg">为你推荐</view> -->
<!-- 商品列表 -->
<view class="goodBox">
<!-- <view class="goodBox">
<view
class="good"
v-for="item in list"
@@ -41,23 +41,68 @@
>
<image :src="(item.cover as string)" />
<view class="good-text-box">
<text class="good-text">{{ item.name }} </text>
<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 style="font-size: 20px"
>{{ item.number }}
</text>
积分
</text>
<!-- <Cart
<Cart
size="20"
color="#ff0000"
@click.stop="add_cart(item.gid as number)"
/> -->
/>
</view>
</view>
</view>
</view> -->
<view class="goodBox">
<view
class="good"
v-for="item in (merdata as any)"
:key="item.ID"
@click.stop="toMerDetails(item)"
>
<image :src="(item.head_photo as string)" />
<view class="good-text-box">
<text class="good-text">{{ item.name }}</text>
<text style="color: #999"
>距离我{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(item.lat),
Number(item.lon)
)
}}</text
>
</view>
</view>
</view>
<!-- 商家列表 -->
<!-- <view class="merBox">
<view class="item" v-for="item in merdata" :key="item.ID">
<view class="left">
<image
class="img"
src="//www.wanzhuanyongcheng.cn/static/bdae68d9512fecacf744eea61f92e71.jpg"
></image>
</view>
<view class="right">
<view class="title">{{ item.name }}</view>
<view class="tag">
<view class="left">
<text>喷射</text>
<text>汉堡</text>
<text>炸鸡</text>
</view>
<view class="right">距我900m</view>
</view>
</view>
</view>
</view> -->
</view>
</template>
@@ -65,8 +110,12 @@
import { ref } from "vue";
// import { Cart } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import { getBanner } from "@/api/user";
import { getGoodsList, addCart } from "@/api/goods";
import { getBanner, bindParent } from "@/api/user";
import {
// getGoodsList,
getMerList,
} from "@/api/goods";
import { calculateDistance } from "@/utils";
const searchValue = ref("");
// const tabvalue = ref("0");
@@ -100,23 +149,71 @@ const userMenuList = ref([
},
]);
interface List {
gid?: number;
name?: string;
number?: number;
cover?: string;
}
// interface List {
// gid?: number;
// name?: string;
// number?: number;
// cover?: string;
// }
const list = ref<Array<List>>([]);
// const list = ref<Array<List>>([]);
Taro.useLoad(() => {
Taro.useDidShow(async () => {
getBannerList();
get_goods_list();
// get_goods_list();
get_mer_list();
if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) {
try {
const res = await bindParent({
uid: Taro.getStorageSync("bind_id"),
});
Taro.showToast({
title: res.msg,
});
Taro.removeStorageSync("bind_id");
} catch (error) {
Taro.removeStorageSync("bind_id");
throw error;
}
}
});
const get_goods_list = async () => {
const { data } = await getGoodsList();
list.value = data.data;
Taro.useShareAppMessage(() => ({
title: "捷兑通",
path: `/pages/index/index?scene=${Taro.getStorageSync("token")}`,
imageUrl:
"https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg",
}));
// const get_goods_list = async () => {
// const { data } = await getGoodsList();
// list.value = data.data;
// };
const merdata = ref([]);
const userLocalNum = ref({
l: 0,
t: 0,
});
const get_mer_list = async () => {
Taro.getLocation({
type: "wgs84",
success: (res) => {
userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude;
},
});
const res = await getMerList({
PageNum: 1,
PageSize: 10,
Btype: 2,
classid: 0,
});
merdata.value = res.data.data;
console.log(res);
};
const getBannerList = async () => {
@@ -146,19 +243,21 @@ const toPage = (url: string) => {
});
};
const toGoodDetails = (gid: number) => {
// const toGoodDetails = (gid: number) => {
// Taro.navigateTo({
// url: `/pages/goods/goods_detail/index?gid=${gid}`,
// });
// };
const toMerDetails = (item: any) => {
Taro.setStorageSync("mer_info", item);
Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${gid}`,
url: `/pages/mer/mer_detail/index`,
});
};
</script>
<style lang="scss">
.app {
box-sizing: border-box;
background-color: #f5f5f5;
}
.nut-swiper-item img {
width: 100%;
height: 350px;
@@ -198,12 +297,13 @@ const toGoodDetails = (gid: number) => {
width: 340px;
background-color: #fff;
margin-bottom: 20px;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
border-radius: 10px;
image {
width: 100%;
height: 350px;
height: 250px;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
.good-text-box {
@@ -216,7 +316,7 @@ const toGoodDetails = (gid: number) => {
font-weight: 400;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
@@ -239,4 +339,60 @@ const toGoodDetails = (gid: number) => {
}
}
}
.merBox {
padding: 10px;
.item {
display: flex;
// align-items: center;
background-color: #fff;
border-radius: 20px;
padding: 20px;
margin-bottom: 10px;
.left {
.img {
width: 150px;
height: 150px;
border-radius: 10px;
}
}
.right {
flex: 1;
margin-left: 15px;
border-bottom: 2px solid #f5f5f5;
.title {
width: 100%;
font-weight: bold;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
.tag {
margin: 10px 0;
color: #999;
width: 100%;
display: flex;
justify-content: space-evenly;
.left {
display: flex;
width: 50%;
text {
margin-right: 10px;
}
}
.right {
flex: 1;
text-align: right;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "",
});

View File

@@ -0,0 +1,308 @@
<template>
<view>
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="red"
auto-play="3000"
>
<nut-swiper-item
v-for="(itm, idx) in (swiperList as any)"
:key="idx"
>
<img
style="width: 100%; height: 100%"
:src="itm"
:alt="idx.toString()"
/>
</nut-swiper-item>
</nut-swiper>
<!-- 商家信息 -->
<view class="infoBox">
<view class="title">{{ mer_info.name }}</view>
<view class="bom">
<view class="left">
<view>{{ mer_info.address || "暂无商家地址" }}</view>
<view class="sub"
>距你{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(mer_info.lat),
Number(mer_info.lon)
)
}}</view
>
</view>
<view class="right">
<view @click="clickMap">
<Locationg3 color="red" size="25" />
<view>导航</view>
</view>
<view @click="clickPhone">
<Find color="red" size="25" />
<view>电话</view>
</view>
</view>
</view>
</view>
<!-- 商品列表 -->
<!-- <view class="good">
<view class="item"></view>
</view> -->
<view class="good-class" v-if="class_list.length > 0">
<nut-tabs
v-model="value"
title-scroll
direction="vertical"
title-gutter="5"
animated-time="0"
name="tabName"
@click="clickTab"
>
<nut-tab-pane
v-for="(item, index) in class_list"
:title="item.name"
:pane-key="index"
>
<view v-if="good_list.length > 0">
<view
class="list"
v-for="(item, index) in (good_list as any)"
:key="index"
>
<view class="item">
<img :src="item.cover" />
<view class="right">
<view class="name">{{ item.name }}</view>
<view class="bom">
<view class="price"
><text style="font-size: 15px">{{
item.number
}}</text>
{{
mer_info.bType === 1
? "元"
: "积分"
}}</view
>
<nut-button
size="mini"
v-if="mer_info.bType === 1"
type="primary"
@click.stop="
toGoodDetails(
item.gid as number,
1
)
"
>去购买</nut-button
>
<nut-button
size="mini"
v-else
type="primary"
@click.stop="
toGoodDetails(
item.gid as number,
2
)
"
>去兑换</nut-button
>
</view>
</view>
</view>
</view></view
>
<nut-empty v-else description="该分类暂无商品"></nut-empty>
</nut-tab-pane>
</nut-tabs>
</view>
<nut-empty v-else description="该商家暂无商品"></nut-empty>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { Find, Locationg3 } from "@nutui/icons-vue-taro";
import { ref } from "vue";
import { calculateDistance } from "../../../utils";
import { getMerCategory, getGoodList } from "../../../api/goods";
const swiperList = ref([]);
const mer_info = ref<any>({});
const value = ref("0");
const userLocalNum = ref({
l: 0,
t: 0,
});
Taro.useLoad(() => {
Taro.getLocation({
type: "wgs84",
success: (res) => {
userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude;
},
});
mer_info.value = Taro.getStorageSync("mer_info");
Taro.setNavigationBarTitle({
title: mer_info.value.name,
});
swiperList.value = mer_info.value.img.split(",");
get_class_list();
});
const clickPhone = () => {
Taro.makePhoneCall({
phoneNumber: mer_info.value.phone,
});
};
const clickMap = () => {
Taro.openLocation({
name: mer_info.value.name,
address: mer_info.value.address,
latitude: Number(mer_info.value.lat),
longitude: Number(mer_info.value.lon),
scale: 18,
});
};
const class_list = ref<
Array<{
ID?: number;
name?: string;
}>
>([]);
const get_class_list = async () => {
const res = await getMerCategory({
Bid: mer_info.value.bid,
});
class_list.value = res.data.data || [];
get_good_list(class_list.value[0].ID as number);
};
const clickTab = (val: any) => {
get_good_list(class_list.value[val.paneKey].ID as number);
};
const good_list = ref([]);
const get_good_list = async (id: number) => {
Taro.showLoading({
title: "加载中",
mask: true,
});
const res = await getGoodList({
bid: mer_info.value.bid,
BType: mer_info.value.bType,
class_id: id,
status: 1,
state: 1,
});
good_list.value = res.data.data || [];
Taro.hideLoading();
};
const toGoodDetails = (id: number, type: number) => {
Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}`,
});
};
</script>
<style lang="scss">
.nut-swiper {
height: 350px;
}
.infoBox {
background-color: #fff;
padding: 20px;
.title {
font-size: large;
font-weight: bold;
}
.bom {
display: flex;
align-items: flex-end;
margin-top: 10px;
.left {
width: 80%;
.sub {
color: #999;
}
}
.right {
flex: 1;
display: flex;
justify-content: space-between;
color: #999;
text-align: center;
}
}
}
.good-class {
margin-top: 10px;
.nut-tabs {
height: 100vh;
border-top: #fff 10px solid;
}
}
.list {
.item {
display: flex;
margin-bottom: 10px;
img {
width: 140px;
height: 140px;
border-radius: 10px;
}
.right {
flex: 1;
margin-left: 5px;
display: flex;
flex-direction: column;
justify-content: center;
// text-align: right;
.name {
// height: 20px;
font-size: 28px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-word;
}
.bom {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-top: 10px;
.price {
font-size: 20px;
font-weight: bold;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '商品添加/编辑'
})

View File

@@ -1,15 +1,158 @@
<script lang="ts">
import {defineComponent} from 'vue'
<script lang="ts" setup>
import Taro from '@tarojs/taro'
import {Ref, ref} from 'vue'
import Upload from '../../../components/Upload.vue'
import RichEditor from '../../../components/RichEditor.vue'
import {addGood} from '@/api/product'
export default defineComponent({
name: "index"
const ruleForm = ref(null) as Ref
const basicData = ref({
name: '',
class_id: null,
cover: [],
rotation: [],
profile: '',
details: '',
stock: null,
number: null,
market_num: null,
state: 2
})
const rules = {
name: [{
required: true,
message: '请填写商品名称'
}],
class_id: [{
required: true,
message: '请选择商品分类'
}],
cover: [{
required: true,
message: '请上传商品封面',
validator: (value) => {
return value.length > 0
}
}],
rotation: [{
required: true,
message: '请上传商品轮播图',
validator: (value) => {
return value.length > 0
}
}],
profile: [{
required: true,
message: '请填写商品名称'
}],
stock: [{
required: true,
message: '请填写商品库存'
}],
number: [{
required: true,
message: '请填写商品价格'
}],
market_num: [{
required: true,
message: '请填写商品市场价'
}]
}
const columnsClass = ref([])
Taro.useLoad((options) => {
console.log(options)
})
const openGoodClass = ref(false)
const confirmClass = (val: any) => {
console.log(val)
}
const ok = async () => {
ruleForm.value.validate().then(({valid, errors}: any) => {
if (valid) {
console.log('success', basicData.value)
} else {
console.log('error submit!!', errors)
}
})
}
</script>
<template>
$END$
<view>
{{ basicData }}
<nut-backtop>
<template v-slot:content>
<nut-form ref="ruleForm" :model-value="basicData" :rules="rules">
<nut-form-item label="商品分类:" required prop="class_id">
<nut-input v-model="basicData.class_id" disabled placeholder="请选择商品分类"
@click="openGoodClass = true"/>
</nut-form-item>
<nut-form-item label="商品封面:" required prop="cover">
<Upload v-model:list="basicData.cover"/>
</nut-form-item>
<nut-form-item label="商品轮播图:" required prop="rotation">
<Upload v-model:list="basicData.rotation" :max="10"/>
</nut-form-item>
<nut-form-item label="商品名称:" required prop="name">
<nut-input v-model="basicData.name" placeholder="请输入商品名称"
type="text"
/>
</nut-form-item>
<nut-form-item label="商品价格:" required prop="number">
<nut-input v-model="basicData.number" placeholder="请输入商品价格"
/>
</nut-form-item>
<nut-form-item label="市场价格:" required prop="market_num">
<nut-input v-model="basicData.market_num" placeholder="请输入市场价格"
/>
</nut-form-item>
<nut-form-item label="商品库存:" required prop="stock">
<nut-input v-model="basicData.stock" placeholder="请输入商品库存"
/>
</nut-form-item>
<nut-form-item label="商品简介:" required prop="profile">
<nut-textarea
class="textarea"
v-model="basicData.profile" placeholder="请输入商品简介"
type="text"/>
</nut-form-item>
<nut-form-item label="上架状态:" prop="state">
<nut-switch v-model="basicData.state" :active-value="1" :inactive-value="2"/>
</nut-form-item>
<nut-form-item prop="details">
<RichEditor :content="basicData.details" @input="(val) => basicData.details = val"/>
</nut-form-item>
<nut-form-item prop="ok">
<nut-button block type="primary" @click="ok">提交</nut-button>
</nut-form-item>
</nut-form>
</template>
</nut-backtop>
<!-- 商品分类 -->
<nut-popup position="bottom" v-model:visible="openGoodClass" @close="openGoodClass = false">
<nut-picker :columns="columnsClass" title="商品分类" @confirm="confirmClass"
></nut-picker>
</nut-popup>
</view>
</template>
<style scoped lang="scss">
<style lang="scss">
.nut-input {
border: none;
color: #000;
}
.textarea {
height: 100px;
background-color: #FAFAFA;
padding: 10px !important;
border-radius: 10px;
}
</style>

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,418 +1,477 @@
<template>
<view class="app">
<view class="app">
<view
class="user-center-card__header__transparent"
v-if="isLogin"
:style="{ width: isLogin ? '100%' : '70%' }"
>
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img :src="userInfo.avatarUrl"/>
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view
class="user-center-card__header__transparent"
v-if="isLogin"
:style="{ width: isLogin ? '100%' : '70%' }"
class="user-center-card__header__info__name"
@click="toPage('/pages/users/user_setting/index')"
>{{ userInfo.nickName }}
</view
>
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img :src="userInfo.avatarUrl" />
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view class="user-center-card__header__info__name">{{
userInfo.nickName
}}</view>
<view v-if="!userInfo.phone">
<nut-button
size="mini"
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
>点击绑定手机号
</nut-button>
</view>
</view>
<view class="rightIcon">
<Scan style="margin-right: 20px" @click="scanCode" size="22" />
<Setting
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</view>
<view v-if="!userInfo.phone">
<nut-button
size="mini"
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
>点击绑定手机号
</nut-button>
</view>
<view v-else class="user-center-card__header__transparent">
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
/>
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view
class="user-center-card__header__info__name"
@tap="clickLogin"
>点击立即授权
</view>
</view>
</view>
<view class="container">
<!--我的订单-->
<view class="cell-card">
<view class="top">
<view>我的订单</view>
<view class="sub" @click="toOrderList(0)">
<view>全部订单</view>
<ArrowRight />
</view>
</view>
<view class="center">
<view class="center-t" @click="toOrderList(1)">
<!-- <Order size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40"
/>
<view class="center-text">待付款</view>
</view>
<view class="center-t" @click="toOrderList(2)">
<!-- <Clock size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
size="40"
/>
<view class="center-text">待使用</view>
</view>
<view class="center-t" @click="toOrderList(3)">
<!-- <Shop size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png"
size="40"
/>
<view class="center-text">已使用</view>
</view>
<view class="center-t" @click="toOrderList(4)">
<!-- <Del size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png"
size="40"
/>
<view class="center-text">已失效</view>
</view>
</view>
</view>
<!-- 我的服务 -->
<view class="user-center">
<view>我的服务</view>
<view class="box">
<view
class="box-mini"
v-if="isLogin"
v-for="item in userMenuList"
:key="item.id"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</view>
</view>
</view>
<!-- 商家管理 -->
<view class="mer-box" v-if="userInfo.bid">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
:border="false"
text="订单核销"
@click="toPage('/pages/admin/verify/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<!-- <nut-grid-item text="订单统计">
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item> -->
</nut-grid>
</view>
<!-- 版权 -->
<!--<view class="copy">© 2023 </view>-->
</view>
<!-- 登录 -->
<Auth
:visible="isShowLogin"
@update:visible="cancelLogin"
@ok="getUserInfo"
</view>
<view class="rightIcon">
<Scan style="margin-right: 20px" @click="scanCode" size="22"/>
<Setting
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</view>
</view>
<view v-else class="user-center-card__header__transparent">
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
/>
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view
class="user-center-card__header__info__name"
@click="clickLogin"
>点击立即登录
</view>
</view>
</view>
<view class="container">
<!--我的订单-->
<view class="cell-card">
<view class="top">
<view>我的订单</view>
<view class="sub" @click="toOrderList(0)">
<view>全部订单</view>
<ArrowRight/>
</view>
</view>
<view class="center">
<view class="center-t" @click="toOrderList(1)">
<!-- <Order size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40"
/>
<view class="center-text">待付款</view>
</view>
<view class="center-t" @click="toOrderList(2)">
<!-- <Clock size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
size="40"
/>
<view class="center-text">待使用</view>
</view>
<view class="center-t" @click="toOrderList(3)">
<!-- <Shop size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png"
size="40"
/>
<view class="center-text">已使用</view>
</view>
<view class="center-t" @click="toOrderList(4)">
<!-- <Del size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png"
size="40"
/>
<view class="center-text">已失效</view>
</view>
</view>
</view>
<!-- 我的服务 -->
<view class="user-center">
<view>我的服务</view>
<view class="box">
<view
class="box-mini"
v-if="isLogin"
v-for="item in userMenuList"
:key="item.id"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</view>
<button v-if="isLogin" class="box-mini" open-type='contact'>
<IconFont size="40"
name="http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png"></IconFont>
<text class="label">联系客服</text>
</button>
</view>
</view>
<!-- 商家管理 -->
<view class="mer-box" v-if="userInfo.bid">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
:border="false"
text="订单核销"
@click="toPage('/pages/admin/verify/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<nut-grid-item
text="订单统计"
@click="toPage('/pages/admin/order_manage/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<nut-grid-item
text="收益提现"
@click="toPage('/pages/admin/withdrawal/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<!-- <nut-grid-item-->
<!-- text="商品管理"-->
<!-- @click="toPage('/pages/product/list/index')"-->
<!-- >-->
<!-- <IconFont-->
<!-- size="50"-->
<!-- name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"-->
<!-- ></IconFont>-->
<!-- </nut-grid-item>-->
</nut-grid>
</view>
<!-- 版权 -->
<!-- <view class="copy">© 2023 </view>-->
</view>
<!-- 登录 -->
<Auth
:visible="isShowLogin"
@update:visible="cancelLogin"
@ok="getUserInfo"
/>
</view>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { ArrowRight, Setting, IconFont, Scan } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import Auth from "@/components/Auth.vue";
import { getPersonalInfo, getPhone, bindParent } from "@/api/user";
import {ref} from 'vue'
import {ArrowRight, Setting, IconFont, Scan} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import Auth from '@/components/Auth.vue'
import {getPersonalInfo, getPhone, bindParent} from '@/api/user'
const isShowLogin = ref(false);
const isShowLogin = ref(false)
const isLogin = ref(false);
const isLogin = ref(false)
interface UserInfo {
nickName?: string;
avatarUrl?: string;
ID?: string;
bid?: string;
phone?: string;
uid?: string;
nickName?: string;
avatarUrl?: string;
ID?: string;
bid?: string;
phone?: string;
uid?: string;
}
const userInfo = ref<UserInfo>({});
const userInfo = ref<UserInfo>({})
Taro.useDidShow(() => {
const token = Taro.getStorageSync("token");
if (token) {
getUserInfo();
}
});
const token = Taro.getStorageSync('token')
if (token) {
getUserInfo()
}
})
const cancelLogin = () => {
isShowLogin.value = false;
};
isShowLogin.value = false
}
const getUserInfo = async () => {
Taro.showLoading({
title: "加载中",
});
const res = await getPersonalInfo();
userInfo.value = res.data.data;
Taro.setStorageSync("userInfo", res.data.data);
Taro.setStorageSync("mer_type", res.data.store_type);
isLogin.value = true;
cancelLogin();
Taro.hideLoading();
};
Taro.showLoading({
title: '加载中'
})
const res = await getPersonalInfo()
userInfo.value = res.data.data
Taro.setStorageSync('userInfo', res.data.data)
Taro.setStorageSync('mer_type', res.data.store_type)
isLogin.value = true
cancelLogin()
Taro.hideLoading()
}
const getphonenumber = async (e: any) => {
await getPhone({
uid: userInfo.value.uid,
code: e.detail.code,
});
getUserInfo();
};
await getPhone({
uid: userInfo.value.uid,
code: e.detail.code
})
await getUserInfo()
}
const toOrderList = (e: number) => {
if (!isLogin)
return Taro.showToast({
title: "请先登录",
icon: "none",
});
Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}`,
});
};
if (!isLogin)
return Taro.showToast({
title: '请先登录',
icon: 'none'
})
Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}`
})
}
const userMenuList = ref([
{
id: 1,
label: "我的账户",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png",
},
// {
// id: 2,
// label: "商家入驻",
// url: "/pages/users/account/index",
// icon: "http://jdt168.com/uploads/default/20220829/583fd6cbd729b24eab9c3cae20ae694d.png",
// },
{
id: 3,
label: "我的推广",
url: "/pages/users/distribution/index",
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
},
{
id: 4,
label: "关注商家",
url: "",
icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
},
{
id: 5,
label: "问题反馈",
url: "",
icon: "http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png",
},
]);
{
id: 1,
label: '我的账户',
url: '/pages/users/account/index',
icon: 'http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png'
},
// {
// id: 2,
// label: "商家入驻",
// url: "/pages/users/account/index",
// icon: "http://jdt168.com/uploads/default/20220829/583fd6cbd729b24eab9c3cae20ae694d.png",
// },
{
id: 3,
label: '我的推广',
url: '/pages/users/distribution/index',
icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png'
},
{
id: 4,
label: '关注商家',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png'
}
// {
// id: 5,
// label: '联系客服',
// url: '',
// icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
// }
])
const toSetting = () => {
Taro.navigateTo({
url: "/pages/users/setting/index",
});
};
Taro.navigateTo({
url: '/pages/users/setting/index'
})
}
const clickLogin = () => {
isShowLogin.value = true;
};
// isShowLogin.value = true
Taro.redirectTo({
url: '/pages/users/login/index'
})
}
const toPage = (url: string) => {
Taro.navigateTo({
url: url,
});
};
Taro.navigateTo({
url: url
})
}
const scanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: async (data) => {
try {
await bindParent({
uid: data.result,
});
Taro.showToast({
title: "绑定成功",
icon: "none",
});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
},
});
};
Taro.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: async (data) => {
try {
await bindParent({
uid: data.result
})
Taro.showToast({
title: '绑定成功',
icon: 'none'
})
} catch (error) {
Taro.showToast({
title: error.msg,
icon: 'none'
})
}
}
})
}
</script>
<style lang="scss">
.app {
box-sizing: border-box;
background-color: #f5f5f5;
height: 100vh;
background-image: url("https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png");
background-size: auto 40%;
background-repeat: no-repeat;
position: relative;
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
box-sizing: border-box;
background-color: #f5f5f5;
height: 100vh;
background-image: url("https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png");
background-size: auto 40%;
background-repeat: no-repeat;
position: relative;
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
}
.user-center-card__header__avatar {
img {
border-radius: 50%;
}
img {
border-radius: 50%;
}
}
.user-center-card__header__transparent {
position: absolute;
left: 30px;
top: 200px;
background-color: transparent;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
text-align: left;
position: absolute;
left: 30px;
top: 200px;
background-color: transparent;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
text-align: left;
.user-center-card__header__info {
margin-left: 20px;
width: 400px;
color: #333;
font-weight: bolder;
}
.user-center-card__header__info {
margin-left: 20px;
width: 400px;
color: #333;
font-weight: bolder;
}
.rightIcon {
height: 100px;
margin: auto;
}
.rightIcon {
height: 100px;
margin: auto;
}
}
.container {
position: absolute;
top: 350px;
width: 710px;
position: absolute;
top: 350px;
width: 710px;
}
.cell-card {
box-sizing: border-box;
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 30px;
width: 710px;
box-sizing: border-box;
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 30px;
width: 710px;
.top {
display: flex;
justify-content: space-between;
align-items: center;
.top {
display: flex;
justify-content: space-between;
align-items: center;
.sub {
display: flex;
color: #c9c9c9;
align-items: center;
}
.sub {
display: flex;
color: #c9c9c9;
align-items: center;
}
}
.center {
display: flex;
justify-content: space-between;
color: #666;
padding: 0 30px;
.center {
display: flex;
justify-content: space-between;
color: #666;
padding: 0 30px;
.center-t {
margin-top: 30px;
display: flex;
flex-direction: column;
align-items: center;
.center-t {
margin-top: 30px;
display: flex;
flex-direction: column;
align-items: center;
.center-text {
margin-top: 15px;
}
}
.center-text {
margin-top: 15px;
}
}
}
}
.user-center {
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 30px;
width: 710px;
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 30px;
width: 710px;
box-sizing: border-box;
.box {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
.box {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
.box-mini {
display: flex;
box-sizing: border-box;
flex-direction: column;
align-items: center;
width: 150px;
margin-bottom: 20px;
margin-right: 13px;
.box-mini {
display: flex;
box-sizing: border-box;
flex-direction: column;
align-items: center;
width: 150px;
margin-bottom: 20px;
margin-right: 13px;
.label {
font-size: 25px;
margin-top: 10px;
color: #333;
}
.label {
font-size: 25px;
margin-top: 10px;
color: #333;
}
image {
width: 80px;
height: 80px;
}
}
image {
width: 80px;
height: 80px;
}
}
button {
width: 150px;
position: relative;
margin-left: auto;
margin-right: auto;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
// font-size: 18px;
text-align: center;
text-decoration: none;
// line-height: 1;
line-height: 1.35;
// border-radius: 5px;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
color: #000000;
background-color: #fff;
height: 100%;
}
button::after {
border: none;
background: transparent;
}
}
}
.mer-box {
box-sizing: border-box;
background-color: #fff;
border-radius: 20px;
margin: 20px;
width: 710px;
box-sizing: border-box;
background-color: #fff;
border-radius: 20px;
margin: 20px;
width: 710px;
}
</style>

View File

@@ -3,22 +3,28 @@ import { ref } from "vue";
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
import { getIntegralDetail, getBeanDetail } from "@/api/user";
const tabValue = ref(0);
const tabValue = ref(1);
const tabsList = ref([
{
title: "积分明细",
value: 0,
title: "兑换明细",
value: 1,
},
{
title: "赠送明细",
value: 3,
},
{
title: "豆子明细",
value: 1,
value: 2,
},
]);
const tabChange = (index: number) => {
tabValue.value = index;
data.value = [];
getList();
page.value.PageNum = 1;
};
const data = ref([]);
@@ -44,16 +50,16 @@ const pageChange = (e: number) => {
const getList = async () => {
try {
let res: any;
if (tabValue.value === 0) {
res = await getBeanDetail({
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
});
const newData = {
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
Type: tabValue.value,
};
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else {
res = await getIntegralDetail({
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
});
delete data.Type;
res = await getIntegralDetail(newData);
}
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
@@ -96,20 +102,24 @@ const getList = async () => {
</view>
</view>
<view v-if="data.length > 0">
<view v-if="tabValue === 0">
<view v-if="tabValue === 1 || tabValue === 3">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view>购买商品{{ item.goods_name }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view>
<view>商品{{ item.goods_name }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: green"
<view v-if="tabValue === 1" style="color: green"
>-<text>{{ item.number }}积分</text></view
>
<view v-if="tabValue === 3" style="color: red"
>+<text>{{ item.number }}</text
>积分</view
>
</view>
</view>
</view>
@@ -120,9 +130,9 @@ const getList = async () => {
:key="index"
>
<view class="left">
<view>购买商品{{ item.goods_name }}</view>
<view>支付金额{{ item.order_number }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view>
<view class="text">商品{{ item.goods_name }}</view>
<view>金额{{ item.order_number }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
@@ -228,5 +238,25 @@ const getList = async () => {
padding: 20px;
justify-content: space-between;
align-items: center;
.left {
width: 500px;
.text {
text-align: left;
width: 100%;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
}
.right {
flex: 1;
text-align: right;
}
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '手机号登录'
})

View File

@@ -1,15 +1,166 @@
<script lang="ts">
import {defineComponent} from 'vue'
<script lang="ts" setup>
import Taro from "@tarojs/taro";
import { ref } from "vue";
import { getVerifyCode, phoneLogin } from "@/api/user";
import logoImg from "../../../static/logo.jpg";
export default defineComponent({
name: "index"
})
Taro.useLoad((options) => {
console.log(options);
});
const basicData = ref({
phone: "",
code: "",
});
const smsDisabled = ref(false);
const smsStr = ref("获取验证码");
// 获取验证码
const getSmsCode = async () => {
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
await getVerifyCode({
phone: basicData.value.phone.toString(),
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
};
const login = async () => {
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
if (!basicData.value.code)
return Taro.showToast({
title: "请输入验证码",
icon: "none",
});
const res = await phoneLogin({
Phone: basicData.value.phone,
Code: basicData.value.code,
Referee: Taro.getStorageSync("bind_id") || "",
});
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
Taro.setStorageSync("token", res.data.token);
setTimeout(() => {
Taro.removeStorageSync("bind_id");
Taro.switchTab({
url: "/pages/user/index",
});
}, 2000);
};
</script>
<template>
$END$
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-form :model-value="basicData" ref="RefForm">
<nut-form-item label="手机号码:">
<nut-input
v-model="basicData.phone"
class="nut-input-text"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="验证码:">
<view style="display: flex">
<nut-input
v-model="basicData.code"
class="nut-input-text"
placeholder="请输入验证码"
type="text"
/>
<nut-button
size="mini"
style="margin-left: 10px"
@click="getSmsCode"
:disabled="smsDisabled"
>{{ smsStr }}</nut-button
>
</view>
</nut-form-item>
<nut-form-item>
<nut-button type="primary" block @click="login"
>登录</nut-button
>
</nut-form-item>
</nut-form>
</view>
</view>
</template>
<style scoped lang="scss">
<style lang="scss">
page {
background: #fff;
}
</style>
.wrapper {
position: relative;
image {
width: 100%;
height: 838px;
}
.logo {
position: absolute;
top: 35%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.center {
position: absolute;
top: 55%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 0px 10px;
}
}
</style>

View File

@@ -12,13 +12,13 @@
<view>{{ item.label }}</view>
</view>
</view>
<view style="width: 45%;"></view>
<view style="width: 45%"></view>
</view>
<!-- 二维码弹窗 -->
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
<view class="popup">
<view>推荐人二维码绑定</view>
<image :src="urlCode" />
<image style="margin-top: 10px" :src="urlCode" />
</view>
</nut-popup>
</view>
@@ -28,6 +28,7 @@
import { ref } from "vue";
import { IconFont } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import { getRefereeCode } from "@/api/user";
const show = ref(false);
@@ -51,12 +52,19 @@ const list = ref([
},
]);
const clickItem = (item: any) => {
const clickItem = async (item: any) => {
if (item.id === 1) {
urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
"token"
)}`;
// urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
// "token"
// )}`;
Taro.showLoading({
title: "加载中",
mask: true,
});
const res = await getRefereeCode();
urlCode.value = `data:image/png;base64,${res.data.data}`;
show.value = true;
Taro.hideLoading();
} else if (item.id === 2) {
Taro.navigateTo({
url: "/pages/users/distribution/integral/index",

View File

@@ -9,7 +9,12 @@
<view class="left">
<view>昵称{{ item.nick_name }}</view>
<view>购买商品{{ item.goods_name }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view>
<view
>订单价格<text style="color: red">{{
item.order_number
}}</text></view
>
<view>购买时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '登录',
navigationStyle: 'custom'
})

View File

@@ -1,15 +1,89 @@
<script lang="ts">
import {defineComponent} from 'vue'
<script setup lang="ts">
import Taro from "@tarojs/taro";
import UserModal from "@/components/UserModal.vue";
import { ref } from "vue";
import logoImg from "../../../static/logo.jpg";
export default defineComponent({
name: "index"
})
const isShow = ref(false);
const getCode = () => {
Taro.showLoading({
title: "授权中...",
mask: true,
});
Taro.login({
success: (res) => {
console.log(res);
Taro.setStorageSync("wx_code", res.code);
isShow.value = true;
},
complete: () => {
Taro.hideLoading();
},
});
};
const toPage = () => {
Taro.navigateTo({
url: "/pages/users/bindPhone/index?type=1",
});
};
</script>
<template>
$END$
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-button type="success" @click="getCode">微信登录</nut-button>
<nut-button style="margin-top: 15px" @click="toPage"
>手机号登录</nut-button
>
</view>
<UserModal v-model:isShow="isShow" @closeEdit="isShow = false" />
</view>
</template>
<style scoped lang="scss">
<style lang="scss">
page {
background: #fff;
}
</style>
.wrapper {
position: relative;
image {
width: 100%;
height: 838px;
}
.logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.center {
position: absolute;
top: 80%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 10px 100px;
}
}
</style>

View File

@@ -6,6 +6,7 @@ import {
showToast,
navigateTo,
setStorageSync,
useDidShow,
} from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
@@ -63,6 +64,9 @@ const orderList = ref<OrderList[]>([]);
useLoad((options) => {
tabValue.value = Number(options.type);
});
useDidShow(() => {
getList();
});
@@ -205,10 +209,10 @@ const getTj = async () => {
<view class="center">
<view class="top">
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view>
<view class="title">{{ item.BindGoods?.name }} </view>
<view class="right">
<view>{{ item.number }}</view>
<view>x{{ item.count }}</view>
<view>{{ item.BindGoods?.number }}</view>
<view>x{{ item?.count }}</view>
</view>
</view>
<!-- <view

View File

@@ -16,12 +16,12 @@
<view class="mer-info">
<view class="left">
<view>
<text>{{ goodInfo.BindStore.name }}</text>
<text>{{ goodInfo.BindStore.phone }}</text>
<text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore?.phone }}</text>
</view>
<nut-ellipsis
:rows="2"
:content="goodInfo.BindStore.address"
:content="goodInfo.BindStore?.address"
direction="end"
></nut-ellipsis>
</view>
@@ -43,12 +43,12 @@
<nut-cell>
<template #default>
<view class="top">
<image :src="goodInfo.BindGoods.cover" />
<image :src="goodInfo.BindGoods?.cover" />
<view class="title"
>{{ goodInfo.BindGoods.name }}
>{{ goodInfo.BindGoods?.name }}
</view>
<view class="right">
<view>{{ goodInfo.number }}</view>
<view>{{ goodInfo.BindGoods?.number }}</view>
<view>x{{ goodInfo.count }}</view>
</view>
</view>
@@ -57,15 +57,13 @@
<nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell>
<nut-cell
title="下单时间:"
:desc="goodInfo.add_time.slice(0, 19)"
:desc="goodInfo.add_time?.slice(0, 19)"
></nut-cell>
<nut-cell
v-if="goodInfo.expires !== 0"
title="商品过期时间:"
title="订单过期时间:"
:desc="
dayjs
.unix(goodInfo.expires)
.format('YYYY-MM-DD HH:mm:ss')
dayjs.unix(goodInfo.expires).format('YYYY-MM-DD HH:mm:ss')
"
></nut-cell>
<nut-cell

View File

@@ -31,6 +31,11 @@ const formValue = ref<any>({
back: [],
head_photo: [],
img: [],
bank: "",
bank_card: "",
bank_name: "",
bank_user: "",
address: "",
});
const merGooList = ref([]);
@@ -78,13 +83,18 @@ const onOk = async () => {
front: formValue.value.front[0]?.url,
back: formValue.value.back[0]?.url,
head_photo: formValue.value.head_photo[0]?.url,
img: formValue.value.img.map((item: any) => item.url),
img: formValue.value.img.map((item: any) => item.url).join(","),
};
const res = await applyMer(data);
Taro.showToast({
title: res.msg,
icon: "none",
});
setTimeout(() => {
Taro.redirectTo({
url: "/pages/index/index",
});
}, 3000);
} catch (e) {
Taro.showToast({
title: e.msg,
@@ -243,6 +253,91 @@ const submit = () => {
</nut-button>
</view>
</nut-form-item>
<nut-form-item
required
label="店铺地址"
prop="address"
:rules="[
{
required: true,
message: '请输入店铺详细地址',
},
]"
>
<input
type="text"
v-model="formValue.address"
placeholder="请输入店铺详细地址"
/>
</nut-form-item>
<nut-form-item
required
label="法人"
prop="bank_user"
:rules="[
{
required: true,
message: '请输入法人',
},
]"
>
<input
type="text"
v-model="formValue.bank_user"
placeholder="请输入法人"
/>
</nut-form-item>
<nut-form-item
required
label="账户名称"
prop="bank_name"
:rules="[
{
required: true,
message: '请输入账户名称',
},
]"
>
<input
type="text"
v-model="formValue.bank_name"
placeholder="请输入账户名称"
/>
</nut-form-item>
<nut-form-item
required
label="开户银行"
prop="bank"
:rules="[
{
required: true,
message: '请输入银行名称',
},
]"
>
<input
type="text"
v-model="formValue.bank"
placeholder="请输入银行名称"
/>
</nut-form-item>
<nut-form-item
required
label="银行卡号"
prop="bank_card"
:rules="[
{
required: true,
message: '请输入银行卡号',
},
]"
>
<input
type="text"
v-model="formValue.bank_card"
placeholder="请输入银行卡号"
/>
</nut-form-item>
<nut-form-item
required
label="商户类型"

View File

@@ -22,6 +22,7 @@ const logOut = () => {
if (res.confirm) {
Taro.removeStorageSync("token");
Taro.removeStorageSync("userInfo");
Taro.removeStorageSync("mer_type");
Taro.reLaunch({
url: "/pages/index/index",
});
@@ -34,7 +35,7 @@ const logOut = () => {
const chooseavatar = (e: any) => {
Taro.uploadFile({
url: `${BASE_URL}/app/upload`,
url: `${BASE_URL}/upload`,
filePath: e.detail.avatarUrl,
name: "file",
header: {