This commit is contained in:
2025-01-08 09:44:25 +08:00
parent 06f6e29972
commit 4d21314fc6
60 changed files with 5477 additions and 4495 deletions
+87 -57
View File
@@ -34,36 +34,36 @@
</block>
</block>
<!-- <view class="card-title web-text-heading">热门项目</view>-->
<!-- <block v-if="itemList.length > 0">-->
<!-- <view class="item-list">-->
<!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<!-- <view-->
<!-- class="grid-item-box"-->
<!-- style="-->
<!-- background-color: #ffffff;-->
<!-- margin: 10rpx;-->
<!-- border-radius: 10rpx;-->
<!-- display: flex;-->
<!-- flex-direction: column;-->
<!-- justify-content: center;-->
<!-- align-items: center;-->
<!-- height: 5rem;-->
<!-- "-->
<!-- >-->
<!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<!-- <text class="text">{{ item.name }}</text>-->
<!-- </view>-->
<!-- </uni-grid-item>-->
<!-- </uni-grid>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- <uni-card :border="false" :padding="'12px 4px'">-->
<!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <view class="card-title web-text-heading">热门项目</view>-->
<!-- <block v-if="itemList.length > 0">-->
<!-- <view class="item-list">-->
<!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<!-- <view-->
<!-- class="grid-item-box"-->
<!-- style="-->
<!-- background-color: #ffffff;-->
<!-- margin: 10rpx;-->
<!-- border-radius: 10rpx;-->
<!-- display: flex;-->
<!-- flex-direction: column;-->
<!-- justify-content: center;-->
<!-- align-items: center;-->
<!-- height: 5rem;-->
<!-- "-->
<!-- >-->
<!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<!-- <text class="text">{{ item.name }}</text>-->
<!-- </view>-->
<!-- </uni-grid-item>-->
<!-- </uni-grid>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- <uni-card :border="false" :padding="'12px 4px'">-->
<!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- 商户列表 -->
<view class="card-title web-text-heading">场地预定</view>
@@ -73,7 +73,7 @@
<uni-grid-item v-for="(item, index) in siteList" :index="index" :key="index">
<view class="merchant-card" style="display: flex; flex-direction: column">
<image :src="item.thumb" mode="widthFix" class="merchant-image"/>
<text class="merchant-name">{{ item.name }}</text>
<text class="merchant-name" style="width: 180rpx">{{ item.name }}</text>
</view>
</uni-grid-item>
</uni-grid>
@@ -95,7 +95,22 @@
<!-- 推荐商品 -->
<!-- <ws-booking :goods="goods"></ws-booking> -->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
<ws-login ref="login" :logo="logo" @done="doLogin"/>
<uv-popup ref="popup" mode="center" round="15" :closeOnClickOverlay="true" bg-color="">
<view v-if="activity && activity.title" @click="toArticle(activity.articleId)" style="width: 60vw"
class="p-30 pos-r bg-white rounded">
<view class="flex flex-col justify-center items-center">
<text class="text-orange font-bold my-20 text-35">热门活动</text>
<text class="my-20">{{ activity.title }}</text>
</view>
<view class="mt-20">
<uv-button type="primary" shape="circle">立即查看</uv-button>
</view>
</view>
<view class="w-100p flex justify-center items-center mt-20" @click="closeActivity">
<uv-icon name="close-circle" size="80rpx" color="white"/>
</view>
</uv-popup>
</layout>
</template>
@@ -111,6 +126,7 @@ import Layout from "@/components/layout.vue";
import * as MenuIcons from '@/api/menu-icons.ts';
import {openUrl} from '@/utils/common';
import {listThinkSite} from "@/api/think/thinkSite";
import {listArticle, pageArticle} from "@/api/cms/article";
const mpStore = useMpStore();
@@ -143,17 +159,40 @@ export default {
hideTools: true,
mp_menu_display_method: 0,
openid: null,
siteList: []
siteList: [],
activity: null,
};
},
onLoad() {
this.reload();
this.openid = uni.getStorageSync('openid');
},
onShow() {
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
// console.log(this.isLogin)
}
},
methods: {
doLogin() {
this.isLogin = true;
this.reload()
},
async getActivity() {
const res = await pageArticle({
categoryId: 2454,
page: 1,
limit: 1,
status: 0,
})
if (res.count > 0) {
this.activity = res.list[0]
this.$refs.popup.open()
}
},
async reload() {
const app = this;
this.getActivity()
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
@@ -162,29 +201,6 @@ export default {
app.mpName = info.config.mpName
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true;
if (!uni.getStorageSync('openid')) {
// 更新openid
// #ifdef MP-WEIXIN
uni.login({
success: (res) => {
getWxOpenId({
code: res.code
}).then((response) => {
uni.setStorageSync('openid', response.openid);
updateUsers({
uid: app.userInfo.ouid,
openid: response.openid,
sessionKey: response.session_key,
unionid: response.unionid
});
});
}
});
// #endif
}
}
// 解析网站参数
if (info.fields) {
@@ -337,6 +353,20 @@ export default {
const json = JSON.parse(item.images);
return json[0].url;
},
toArticle(articleId) {
this.openUrl(`/package/article/detail?articleId=${articleId}`);
this.$refs.popup.close()
},
closeActivity(){
this.$refs.popup.close()
}
},
onShareAppMessage() {
return {
title: '广西体育中心',
path: '/pages/index'
}
}
};
</script>
+250 -114
View File
@@ -4,12 +4,18 @@
<!-- <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"-->
<!-- inActiveColor="#808080" @clickItem="onClickItem"/>-->
<!-- </view>-->
<uv-sticky>
<view class="flex justify-center items-center p-10">
<uv-sticky title="订单" bg-color="white">
<view class="w-100p" :style="{height: `${safeTop}px`}"></view>
<view v-if="hasMerchantRole || hasMerchantClerkRole || hasSuperAdminRole"
class="px-20 pb-20 flex justify-center items-center" style="width: calc(100vw - 250rpx)">
<uv-input v-model="orderNo" shape="circle" clearable placeholder="订单号搜索"
:customStyle="{backgroundColor: 'white'}" @change="reload"/>
</view>
<view class="flex justify-center items-center p-10" style="width: calc(100vw - 220rpx); height: 40px">
<view class="flex-2 mx-15 flex justify-center" @click="openOrderTypePicker">
<uv-icon name="arrow-down" :label="orderTypeStr" label-pos="left"/>
</view>
<view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker">
<view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker" v-if="orderType !== 2">
<uv-icon name="arrow-down" :label="orderStatusStr" label-pos="left"/>
</view>
<view class="flex-1 mx-15 flex justify-center" @click="reset">
@@ -19,92 +25,131 @@
</uv-sticky>
<view class="order">
<block v-if="orderList.length > 0">
<block v-for="(item,index) in orderList" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title>
<div class="order-title web-cell">
<view class="web-cell web-cell-content" v-if="orderType === 0">
<text class="merchant-name">{{ item.siteName }}</text>
</view>
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
<text class="merchant-name">{{ item.siteNames }}</text>
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
</view>
<block v-if="item.orderStatus === 3">
<text class="btn-status web-text-secondary">已取消</text>
</block>
<block v-else-if="item.orderStatus === 1">
<text class="btn-status web-text-success">已完成</text>
</block>
<block v-else>
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
<view v-if="item.payStatus === 0" class="btn-status web-text-danger">
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
<template v-if="orderType === 2">
<view v-for="(item, index) in orderList" class="card m-20" :key="index">
<view class="pb-20 border-bottom flex justify-between items-center text-25">
<text>{{ item.orderNum }}</text>
<text v-if="item.status === 0">未支付</text>
<text v-if="item.status === 1" class="text-red">已支付,未退款</text>
<text v-if="item.status === 2" class="text-green">已退款</text>
</view>
<view class="py-20 border-bottom flex justify-between items-center text-25">
<text>{{ item.siteName }}-{{ item.info }}</text>
<text class="text-red font-bold">¥{{ item.money }}</text>
</view>
<view class="py-20 flex justify-start items-center text-25 text-gray">
<text>{{ dayjs(item.createTime * 1000).format('YYYY-MM-DD HH:mm:ss') }}</text>
</view>
</view>
</template>
<template v-else>
<block v-for="(item,index) in orderList" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title>
<div class="order-title web-cell">
<view class="web-cell web-cell-content">
<text class="merchant-name">订单号: {{ item.orderNum }}</text>
</view>
</block>
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content" @click="toDetail(item.id)">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0">
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex">
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
<text class="merchant-name">{{ item.siteNames }}</text>
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
</view>
<block v-if="item.orderStatus === 3">
<text class="btn-status web-text-secondary">已取消</text>
</block>
</uv-cell-group>
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-else-if="orderType === 1">
<uv-cell :title="item.name"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false">
</uv-cell>
</uv-cell-group>
<view class="total-price" v-if="orderType === 0">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
</view>
<view class="total-price" v-else-if="orderType === 1">
<view class="web-text-heading">合计:¥{{ item.price }}</view>
<block v-else-if="item.orderStatus === 1">
<text class="btn-status web-text-success">已完成</text>
</block>
<block v-else>
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
<view v-if="item.payStatus === 0" class="btn-status web-text-danger">
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
</view>
</block>
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content" @click="toDetail(item.id)">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0">
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex">
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
</block>
</uv-cell-group>
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false"
v-else-if="orderType === 1">
<uv-cell :title="item.name"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false">
</uv-cell>
</uv-cell-group>
<view class="total-price" v-if="orderType === 0">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
</view>
<view class="total-price" v-else-if="orderType === 1">
<view class="web-text-heading">合计:¥{{ item.price }}</view>
</view>
</view>
</view>
</view>
<view slot="actions" class="card-actions">
<template v-if="orderType === 0">
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
<button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPayOrder(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.payStatus == 1">
<button class="mini-btn" size="mini" v-if="item.isOpen === 2" @click="onInvoice(item.orderId)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
</view>
</template>
<template v-else-if="orderType === 1">
<view class="card-actions-item" v-if="item.status === 2">
<button class="mini-btn" size="mini" @click="closeVipOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPay(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.status === 1">
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item.id)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
</view>
</template>
</view>
</uni-card>
</block>
<view slot="actions" class="card-actions">
<template v-if="orderType === 0">
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
<button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPayOrder(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.payStatus === 1">
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 4">
退款中
</button>
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 6">
{{ item.payType === 1 ? '退款成功' : '已取消' }}
</button>
<button class="mini-btn mx-10" size="mini"
v-if="item.orderStatus === 2 && item.canRefund"
@click="refund(item, index)" :disabled="item.disabled">
{{ item.payType === 1 ? '申请退款' : '取消订单' }}
</button>
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 2" @click="toDetail(item.id)">
核销码
</button>
<button class="mini-btn mx-10" size="mini" v-if="item.canInvoice" @click="onInvoice(item)">
申请开票
</button>
<button class="mini-btn mx-10" size="mini" v-else-if="item.isInvoice === 1"
@click="showInvoice(item.id)">
查看发票
</button>
</view>
</template>
<template v-else-if="orderType === 1">
<view class="card-actions-item" v-if="item.payStatus === 2">
<button class="mini-btn" size="mini" @click="closeVipOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPay(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.status === 1">
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else-if="item.isInvoice === 1" @click="showInvoice(item.id)">
查看发票
</button>
</view>
</template>
</view>
</uni-card>
</block>
</template>
</block>
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
@@ -141,24 +186,34 @@
<script>
import * as OrderApi from '@/api/think/thinkOrder'
import {
pageThinkWechatDeposit
} from '@/api/think/thinkWechatDeposit'
import {
getWeek,
getKey
} from '@/utils/common';
import {pageThinkOrder, thinkOrderRepay} from "@/api/think/thinkOrder";
import {pageThinkOrder, thinkOrderRepay, updateThinkOrder} from "@/api/think/thinkOrder";
import {pageThinkUsersVip, thinkUsersVipRepay, updateThinkUsersVip} from "@/api/think/thinkUsersVip";
import {pageThinkDeposit} from "@/api/think/thinkDeposit";
import dayjs from "dayjs";
import * as Api from "@/api/booking/userInvoice";
import {addThinkOrderRefundLog} from "@/api/think/thinkOrderRefundLog";
import {authUser} from "@/api/user";
import {useUserStore} from "@/store/modules/user";
const userStore = useUserStore();
export default {
computed: {
dayjs() {
return dayjs
}
},
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
userInfo: null,
where: {
page: 1
// sceneType: 'showOrderInfo' // 查询订单附加场地信息
@@ -214,6 +269,11 @@ export default {
],
orderStatusStr: '全部状态',
orderStatus: null,
hasMerchantRole: false,
hasMerchantClerkRole: false,
hasSuperAdminRole: false,
orderNo: '',
safeTop: 44,
}
},
// async onLoad(option) {
@@ -225,7 +285,16 @@ export default {
// // }
// },
async onShow(e) {
const sysInfo = uni.getSystemInfoSync()
this.safeTop = sysInfo.statusBarHeight
this.userId = await uni.getStorageSync('user_id')
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
this.userInfo = userInfo;
this.hasMerchantRole = userInfo.roles.find((d) => d.roleCode === 'merchant');
this.hasMerchantClerkRole = userInfo.roles.find((d) => d.roleCode === 'merchantClerk');
this.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
}
await this.reload()
},
// 触底函数
@@ -273,18 +342,63 @@ export default {
},
async getOrderList() {
let res
if (this.orderType === 0) res = await pageThinkOrder(this.where)
else if (this.orderType === 1) res = await pageThinkUsersVip(this.where)
else if (this.orderType === 2) res = await pageThinkDeposit(this.where)
if (this.orderType === 0) {
if (this.orderNo) {
this.where.orderNum = this.orderNo
this.where.forAdmin = true
} else {
this.where.orderNum = null
this.where.forAdmin = null
}
res = await pageThinkOrder(this.where).catch(err => {
this.$refs.login.open('bottom')
})
} else if (this.orderType === 1) res = await pageThinkUsersVip(this.where).catch(err => {
this.$refs.login.open('bottom')
})
else if (this.orderType === 2) res = await pageThinkDeposit(this.where).catch(err => {
this.$refs.login.open('bottom')
})
if (this.orderList.length < res.count) {
this.orderList = this.orderList.concat(res.list)
let list = res.list
if (this.orderType === 1) list = list.map(item => {
item.orderNum = item.wechatOrder
item.payPrice = item.price
return item
})
if (this.orderType === 0) list = list.map(item => {
item.canRefund = false
// 游泳馆没有用就可以退
if (item.sid === 37) {
if (item.orderStatus === 2) item.canRefund = true
} else {
// 可提前6小时退
item.canRefund = item.startTime - dayjs().unix() > (3600 * 6)
}
item.disabled = false
return item
})
this.orderList = this.orderList.concat(list)
console.log(this.orderList)
this.canReset = true
this.loadMore = 'no-more'
} else {
this.canReset = false;
this.loadMore = 'no-more'
}
if (this.orderType !== 2) {
this.orderList = this.orderList.map(item => {
item.canInvoice = false
if (this.orderType === 0 && item.isInvoice === 2 && item.orderStatus === 1) {
const date = item.dateTime.split("(")[0]
const endTime = item.dateTime.split(" - ")[1]
const time = `${date} ${endTime}:00`
if (dayjs().isAfter(dayjs(time))) item.canInvoice = true
}
return item
})
}
},
async onClickItem(e) {
const app = this
@@ -353,26 +467,20 @@ export default {
})
},
closeOrder(item) {
const _this = this
uni.showModal({
title: '确定取消此订单?',
success(o) {
async success(o) {
if (o.confirm) {
OrderApi.updateOrder({
orderStatus: 2,
orderId: item.orderId
}).then(msg => {
uni.showToast({
title: msg,
icon: 'none'
})
item.orderStatus = 2;
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
await updateThinkOrder({
orderStatus: 3,
id: item.id
})
uni.showToast({
title: '取消成功',
icon: 'none'
})
await _this.reload()
}
}
});
@@ -386,10 +494,10 @@ export default {
}
},
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
})
onInvoice({id, orderNum, payPrice}) {
let url = `/package/user/invoice?id=${id}&orderNum=${orderNum}&itype=${this.orderType + 1}`
url += `&price=${payPrice}`
uni.navigateTo({url})
},
showInvoice(id) {
uni.navigateTo({
@@ -461,7 +569,7 @@ export default {
}
})
},
reset(){
reset() {
this.where = {
page: 1
}
@@ -471,6 +579,34 @@ export default {
this.orderStatus = null
this.orderStatusStr = '全部状态'
this.reload()
},
refund(order, index) {
uni.showModal({
title: '确定要退款吗?',
success: async ({confirm}) => {
if (confirm) {
this.orderList[index].disabled = true
uni.showLoading({
title: '退款请求中'
})
await addThinkOrderRefundLog({
uid: order.uid,
refundAmount: order.payPrice,
sid: order.sid,
oid: order.id,
status: 1,
type: 0
})
this.orderList[index].disabled = false
uni.hideLoading()
uni.showToast({
title: '申请退款成功',
icon: 'none'
})
await this.reload()
}
}
})
}
}
}
+58 -158
View File
@@ -1,6 +1,5 @@
<template>
<layout class="container" @done="onLayout">
<view>
<!-- 幻灯片广告 -->
<block v-if="shopInfo.files">
<view class="uv-demo-block" style="width: 750rpx; margin: auto">
@@ -9,109 +8,34 @@
radius="0" height="200" @click="onSlide"></uv-swiper>
</view>
</block>
<!-- search-->
<view class="search" style="padding: 0 10rpx; background-color: #FFFFFF">
<uni-search-bar radius="5" placeholder="搜索商品" v-model="keywords" clearButton="auto" cancelButton="none" @confirm="search"/>
<view class="flex flex-wrap justify-start items-start card m-20">
<view v-for="(item, index) in list" :key="index" class="m-15" @click="selectCate(item)">
<uv-icon size="60rpx" :name="item.image" :label="item.catname"
label-pos="bottom" label-size="25rpx" space="8"></uv-icon>
</view>
</view>
<!-- <uv-gap height="8"></uv-gap>-->
<uv-vtabs
:chain="chain"
:list="list"
keyName="title"
:height="height"
:barItemActiveStyle="{color: '#ff0000'}"
:barItemActiveLineStyle="{background: '#ff0000'}"
hdHeight="100rpx"
@change="change">
<template v-for="(item,index) in children" :key="index">
<uv-vtabs-item :index="index">
<view class="item">
<text class="ele-text-secondary" style="color: #808080">{{ item.title }}</text>
<view class="flex flex-wrap justify-start items-start">
<view class="w-50p" v-for="(item, index) in goodsList" :key="index" @click="navTo(`/package/goods/detail?id=${item.goodsId}`)">
<view class="card m-20">
<uv-image :src="item.image" width="300rpx" height="300rpx"></uv-image>
<view class="mt-20 flex justify-between items-center">
<text class="text-25">{{ item.title }}</text>
</view>
<view class="item"
v-for="(item,index2) in item.goods"
:key="index2">
<view class="flex">
<uv-image :src="item.image" width="80" height="80" radius="6"
@click="navTo(`/package/goods/detail?id=${item.goodsId}`)"/>
<view class="goods-info ml-2" style="flex: 1">
<view class="flex flex-col justify-between" style="height: 80px">
<view class="goods-bar">
<view class="goods-name">{{ item.goodsName }}</view>
<view class="goods-desc web-text-secondary">{{ item.comments }}</view>
</view>
<view class="flex justify-between goods-price-bar">
<view class="goods-price">¥{{ item.price }}</view>
<block v-if="item.specs === 1">
<uv-button type="error" class="goods-btn" size="mini" @click="openSpecForm(item)"
:customStyle="{backgroundColor: '#ff0000', color: '#ffffff'}">选规格
</uv-button>
</block>
<block v-else>
<uv-number-box v-model="item.totalNums"
step="1"
:min="0"
:showMinus="item.totalNums > 0"
@change="addNum(item)"
>
<template v-slot:minus>
<view class="minus">
<uv-icon
name="minus"
size="12">
</uv-icon>
</view>
</template>
<template v-slot:input>
<text
style="width: 18px;text-align: center;"
class="input"
>
{{ item.totalNums }}
</text>
</template>
<template v-slot:plus>
<view class="plus">
<uv-icon
name="plus"
color="#FFFFFF"
size="12"
>
</uv-icon>
</view>
</template>
</uv-number-box>
</block>
</view>
</view>
</view>
</view>
</view>
<view
class="gap"
v-if="index<list.length-1">
<uv-gap bg-color="#f1f1f1" height="4"></uv-gap>
</view>
</uv-vtabs-item>
</template>
</uv-vtabs>
<text class="text-red text-25 mt-10">¥{{ item.minPrice }}</text>
</view>
</view>
</view>
<!-- 购物车 -->
<view class="cart-icon">
<view class="icon" style="position: relative" @click="navTo(`/package/cart/index`)">
<uv-badge type="error" max="40" :value="cart.totalNums"
style="position: absolute; top: -1px; right: -1px; z-index: 9;"></uv-badge>
<view style="position: absolute; top: -1px; right: -1px; z-index: 9;">
<uv-badge type="error" max="40" :value="cart.length"></uv-badge>
</view>
<uv-icon name="shopping-cart" size="30" color="#0c9d04"></uv-icon>
</view>
</view>
<!-- 支付密码弹窗 -->
<uni-popup ref="specForm" type="center" border-radius="10px 10px 0 0">
<uni-card :title="goods.goodsName" :border="false" :is-shadow="false" :padding="0">
<view class="spec-card" style="width: 660rpx;">
@@ -159,22 +83,20 @@
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" @done="reload"/>
</layout>
</view>
</template>
<script>
import Layout from "@/components/layout.vue";
import {listCategoryParentIdTree, listCategoryTree} from '@/api/shop/goodsCategory';
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import UvButton from "@/uni_modules/uv-button/components/uv-button/uv-button.vue";
import {useMpStore} from "@/store/modules/mp";
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import * as CartApi from "@/api/shop/cart";
import {ShoppingCartOutlined} from '@ant-design/icons-vue';
const mpStore = useMpStore();
import {listThinkGoodsCategory} from "@/api/think/thinkGoodsCategory";
import {listThinkGoods} from "@/api/think/thinkGoods";
export default {
components: {UvGap, UvButton, UvImage, UvAvatar, Layout, ShoppingCartOutlined},
@@ -184,9 +106,6 @@ export default {
goods: {},
cart: {},
isLogin: false,
// 配置信息
config: {},
mpMenus: [],
list: [],
children: [],
chain: false,
@@ -198,7 +117,9 @@ export default {
// 支付密码是否正确
isPayPasswordCorrect: false,
disabledPayPayPassword: false,
payPassword: ''
payPassword: '',
goodsList: [],
cateId: null
}
},
computed: {
@@ -206,70 +127,53 @@ export default {
return uni.getSystemInfoSync().windowHeight - uni.upx2px(108);
}
},
onLoad() {
async onLoad() {
await this.reload();
this.listCart();
},
onReady() {
// 模拟接口请求数据
uni.showLoading({
title: '加载中'
})
this.reload();
// setTimeout(() => {
// // this.list = getList;
// this.reload()
// }, 500)
await this.getGoodsList();
},
methods: {
async reload() {
const app = this;
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true;
this.isLogin = true;
}
// 查询店铺分类
listCategoryTree({type: 0}).then(data => {
app.list = data;
if (data.length > 0) {
const parentId = data[0].categoryId
listCategoryParentIdTree(parentId).then(children => {
app.children = children;
})
}
}).finally(err => {
uni.hideLoading();
})
this.list = await listThinkGoodsCategory()
// console.log(this.list)
},
listCart() {
CartApi.listCart({type: 0, isNew: false}).then(data => {
CartApi.listCart({type: 0}).then(data => {
if (data) {
this.cart = data
// uni.setTabBarBadge({
// index: 1,
// text: `${data.totalNums}`
// })
}
})
},
async getGoodsList(){
this.goodsList = await listThinkGoods({
status: 1,
cid: this.cateId
})
},
selectCate(item){
this.cateId = item.id
this.getGoodsList()
},
navTo(url) {
console.log('>>>>>url')
if (url === '/package/cart/index' && !this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.navigateTo({url})
},
change(index) {
const app = this
this.children = this.list[index].children;
const parentId = this.list[index].categoryId
listCategoryParentIdTree(parentId).then(children => {
app.children = children;
})
console.log('选项改变:', index)
},
// change(index) {
// const app = this
// this.children = this.list[index].children;
// const parentId = this.list[index].categoryId
// listCategoryParentIdTree(parentId).then(children => {
// app.children = children;
// })
// console.log('选项改变:', index)
// },
openSpecForm(goods) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
@@ -286,6 +190,8 @@ export default {
}
CartApi.addCart({
...item,
goodsName: item.title,
price: item.minPrice,
spec: this.skuText,
cartNum: 1
}).then(() => {
@@ -327,7 +233,7 @@ export default {
onSlide() {
},
search(){
search() {
uni.navigateTo({
url: '/package/goods/index?keywords=' + this.keywords
})
@@ -337,12 +243,6 @@ export default {
uni.navigateTo({
url: '/package/goods/checkout?goodsId=' + this.goods.goodsId
})
},
onLayout(data) {
if (data) {
// 页面图标链接
this.mpMenus = data.mpMenus;
}
}
}
}
+179 -106
View File
@@ -20,87 +20,150 @@
<!-- 我的订单 -->
<!-- <ws-user-order :order="order" :is-login="isLogin" @done="openLogin"></ws-user-order> -->
<!-- 其他功能 -->
<uni-card :border="false" :padding="0">
<!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole">
<view class="server" style="min-height: 200px">
<uni-list :border="false">
<block v-for="(item, index) in mpMenus" :key="index">
<block v-if="index === '1981'" v-for="(v,i) in item">
<uni-list-item :thumb="v.avatar" link @click="navTo(v)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{
v.title
}}
</text>
</view>
</template>
</uni-list-item>
</block>
</block>
</uni-list>
<uni-card :border="false" :padding="0">
<!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole">
<view class="card">
<block v-for="(item, index) in mpMenus" :key="index">
<block v-if="index === '1981'" v-for="(v, i) in item" :key="i">
<view class="flex justify-between items-center py-20 border-bottom" @click="navTo(v)">
<view class="flex justify-start items-center">
<uv-icon :name="v.avatar"/>
<text class="text-30 ml-20">{{ v.title }}</text>
</view>
<uv-icon name="arrow-right" size="24rpx"/>
</view>
</block>
<block v-else>
<!-- 普通会员菜单 -->
<view class="server" style="min-height: 200px">
<uni-list :border="false">
<block v-for="(item, index) in mpMenus" :key="index">
<block v-if="index === '1981'" v-for="(v,i) in item">
<uni-list-item :thumb="v.avatar" link @click="navTo(v)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{
v.title
}}
</text>
</view>
</template>
</uni-list-item>
</block>
</block>
</uni-list>
</view>
</block>
<view class="flex justify-between items-center py-20 border-bottom" @click="scan">
<view class="flex justify-start items-center">
<uv-icon name="https://oss.wsdns.cn/20241126/92f728b3b4e146d6a916259bde11a209.png"/>
<text class="text-30 ml-20">扫码核销</text>
</view>
<uv-icon name="arrow-right" size="24rpx"/>
</view>
<!-- <button class="share-btn" open-type="contact">-->
<!-- <view class="flex justify-between items-center py-20 border-bottom">-->
<!-- <view class="flex justify-start items-center">-->
<!-- <uv-icon name="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png"/>-->
<!-- <text class="text-30 ml-20" style="font-weight: normal!important;">联系客服</text>-->
<!-- </view>-->
<!-- <uv-icon name="arrow-right" size="24rpx"/>-->
<!-- </view>-->
<!-- </button>-->
</view>
<!-- <view class="server" style="min-height: 200px">-->
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- <uni-list-item thumb="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png" link>-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <button class="share-btn" open-type="contact">联系客服</button>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </uni-list>-->
<!-- </view>-->
</block>
<block v-else>
<!-- 普通会员菜单 -->
<view class="server" style="min-height: 200px">
<view class="card">
<block v-for="(item, index) in mpMenus" :key="index">
<block v-if="index === '1981'" v-for="(v, i) in item" :key="i">
<view class="flex justify-between items-center py-20 border-bottom" @click="navTo(v)">
<view class="flex justify-start items-center">
<uv-icon :name="v.avatar"/>
<text class="text-30 ml-20">{{ v.title }}</text>
</view>
<uv-icon name="arrow-right" size="24rpx"/>
</view>
</block>
</block>
</uni-card>
<!-- <button class="share-btn" open-type="contact">-->
<!-- <view class="flex justify-between items-center py-20 border-bottom">-->
<!-- <view class="flex justify-start items-center">-->
<!-- <uv-icon name="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png"/>-->
<!-- <text class="text-30 ml-20" style="font-weight: normal!important;">联系客服</text>-->
<!-- </view>-->
<!-- <uv-icon name="arrow-right" size="24rpx"/>-->
<!-- </view>-->
<!-- </button>-->
</view>
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- <uni-list-item thumb="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png" link>-->
<!-- <template v-slot:body>-->
<!-- <button class="share-btn" open-type="contact">联系客服</button>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </uni-list>-->
</view>
</block>
</uni-card>
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <uv-avatar :src="item.avatar" :size="24" mode="widthFix"></uv-avatar>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <block v-if="index === '1982' && (hasMerchantClerkRole || hasMerchantRole)">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- </block>-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <uv-avatar :src="item.avatar" :size="24" mode="widthFix"></uv-avatar>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <block v-if="index === '1982' && (hasMerchantClerkRole || hasMerchantRole)">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- </block>-->
<!-- <ws-personal :form="users" ref="personal" @done="reload" />-->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
@@ -114,7 +177,7 @@
import {useUserStore} from '@/store/modules/user';
import * as MpMenuApi from '@/api/cms/mp-menu';
import * as UserCardApi from '@/api/booking/userCard';
import {getThinkUsers,updateThinkUsers} from '@/api/think/thinkUsers';
import {getThinkUsers, updateThinkUsers} from '@/api/think/thinkUsers';
import {openUrl} from '@/utils/common';
import {useMpStore} from "@/store/modules/mp";
import {getWxOpenId, loginByOpenId} from '@/api/passport/login';
@@ -123,6 +186,7 @@ import Layout from "@/components/layout.vue";
import {useTenantStore} from '@/store/modules/tenant';
import {authUser} from "@/api/user";
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import {getThinkOrderByCode} from "@/api/think/thinkOrder";
const tenantStore = useTenantStore();
const mpStore = useMpStore();
@@ -185,10 +249,10 @@ export default {
app.isLogin = true;
}
// 获取旧系统用户信息
if(uni.getStorageSync('uid')){
if (uni.getStorageSync('uid')) {
await getThinkUsers(uni.getStorageSync('uid')).then(data => {
app.users = data;
console.log(app.users,'>>>>')
console.log(app.users, '>>>>')
})
}
// 当前登录用户信息
@@ -199,7 +263,7 @@ export default {
uni.setStorageSync('user_id', app.userInfo.userId);
// 更新第三方系统的用户ID
if(!userInfo.uid && uni.getStorageSync('uid')){
if (!userInfo.uid && uni.getStorageSync('uid')) {
await authUser({uid: uni.getStorageSync('uid')}).then(res => {
console.log('更新第三方系统的用户ID')
})
@@ -267,31 +331,21 @@ export default {
}
// 菜单数据
MpMenuApi.pageMpMenu({type: 0, limit: 100})
.then((res) => {
app.order = res.list.filter((d) => d.rows == 0);
app.server = res.list.filter((d) => d.rows == 1);
// console.log('app.hasMerchantRole: ',app.hasMerchantRole);
// console.log('app.hasMerchantClerkRole: ',app.hasMerchantClerkRole);
// console.log('app.hasSuperAdminRole: ',app.hasSuperAdminRole);
if (!app.hasMerchantRole && !app.hasMerchantClerkRole) {
// console.log('11111: ',11111);
app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0);
}
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.hideTools = false;
.then((res) => {
app.order = res.list.filter((d) => d.rows == 0);
app.server = res.list.filter((d) => d.rows == 1);
if (!app.hasMerchantRole && !app.hasMerchantClerkRole) {
app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0);
}
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
UserCardApi.pageUserCard({payStatus: 1, userId: uni.getStorageSync('user_id')}).then(res => {
console.log('res8888889: ', res);
app.userInfo.cards = res.count
app.userInfo.coupon = 1;
})
app.hideTools = false;
});
},
navTo(item) {
if (!this.isLogin) {
@@ -312,9 +366,28 @@ export default {
this.$refs.login.open('bottom');
return false;
}
if(text){
if (text) {
uni.navigateTo({url: text})
}
},
scan() {
uni.scanCode({
onlyFromCamera: true,
success: async ({result}) => {
const res = await getThinkOrderByCode(result)
if (!res.res) return uni.showToast({
title: res.msg,
icon: 'none'
})
uni.navigateTo({url: `/package/order/check?id=${res.data.id}`})
},
fail: (err) => {
uni.showToast({
title: '扫码失败',
icon: 'none'
})
}
});
}
}
};