优化框架

This commit is contained in:
2024-08-08 01:53:51 +08:00
parent d0adbaff13
commit 24e63cf551
16 changed files with 1454 additions and 493 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ export interface Users {
// 真实姓名
realName?: string;
// 是否管理员:1是;2否
isAdmin?: string;
isAdmin?: boolean;
// 客户端ID
clientId?: string;
// 注册来源客户端 (APP、H5、小程序等)
+2
View File
@@ -82,6 +82,8 @@ export interface User {
recommend?: number;
userProfile?: any;
system?: any;
loginNum?: number;
openid?: string;
}
/**
+7
View File
@@ -20,6 +20,11 @@ export interface User {
phone?: string;
// 邮箱
email?: string;
province?: string;
city?: string;
region?: string;
idCard?: string;
idCardNo?: string;
// 出生日期
birthday?: string;
// 手机号
@@ -36,6 +41,8 @@ export interface User {
organizationName?: string;
// 创建时间
createTime?: string;
// 登录次数
loginNum?: number;
}
/**
+4 -5
View File
@@ -7,7 +7,7 @@
</view>
</uni-card>
<uni-card :border="false" :is-shadow="false">
<uni-card :border="false" :is-shadow="false" v-if="address.name">
<uv-cell
v-if="deliveryType === 0"
:title="`${address.name} &nbsp; ${address.phone}`"
@@ -23,12 +23,11 @@
</uv-cell>
<uv-cell
v-if="deliveryType === 1"
:title="`${shopAddress.merchantName}`"
:label="`${shopAddress.address}`"
:title="`${cart.shops[0].shopName}`"
:label="`${cart.shops[0].address}`"
icon="map"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="openAddressList"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
@@ -302,7 +301,6 @@ export default {
};
},
onLoad(where) {
console.log('where:',where)
this.where = where;
this.reload();
},
@@ -331,6 +329,7 @@ export default {
CartApi.listCart(where).then(data => {
if(data){
app.cart = data
console.log(app.cart.shops);
}
})
+68 -19
View File
@@ -3,10 +3,9 @@
<view class="goods-info">
<uv-swiper :list="photo" indicator indicatorMode="line" circular height="750rpx" radius="0"></uv-swiper>
</view>
<!-- <view class="merchant-name">{{ form.merchantName }}</view> -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<uv-cell :cellStyle="{padding: '10px 5px'}">
<uv-cell :border="false" :cellStyle="{padding: '10px 5px'}">
<template v-slot:title>
<view class="pirce-bar" style="display: flex;">
<view class="web-text-danger">¥</view>
@@ -17,20 +16,66 @@
<text class="web-text-secondary" style="text-decoration: line-through">划线价¥{{ form.price * 2 }}</text>
</template>
</uv-cell>
<uv-cell :title="form.goodsName" label="商品名称" :cellStyle="{padding: '10px 5px'}">
<uv-cell :cellStyle="{padding: '0px 5px 15px 5px'}">
<template v-slot:title>
<view class="flex">
<view class="web-text-heading font-bold" style="font-size: 26rpx; ">{{ form.goodsName }}</view>
</view>
</template>
</uv-cell>
<!-- <uv-cell title="选择款式" :label="`100zz【藏青色】、100zz【古红色】`" isLink-->
<!-- :cellStyle="{padding: '10px 5px'}">-->
<!-- </uv-cell>-->
<uv-cell title="参数" :label="form.goodsName" :cellStyle="{padding: '10px 5px'}">
</uv-cell>
<uv-cell title="客服电话" label="0771-8888888" :border="false" :cellStyle="{padding: '10px 5px'}"
@click="callPhone('0771-8888888')">
<!-- <uv-cell title="参数" :label="form.goodsName" :cellStyle="{padding: '10px 5px'}">-->
<!-- </uv-cell>-->
<!-- <uv-cell title="客服电话" label="0771-8888888" :border="false" :cellStyle="{padding: '10px 5px'}"-->
<!-- @click="callPhone('0771-8888888')">-->
</uv-cell>
<!-- </uv-cell>-->
</uv-cell-group>
</uni-card>
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell :cellStyle="{padding: '10px 5px'}" :center="true" @click="openSpecForm">
<template v-slot:title>
<view class="flex" v-if="!skuText">
<view class="web-text-secondary w-15p">可选</view>
<view class="uv-page__tag-item" v-for="(item, index) in form.goodsSpecValue" :key="index">
<uv-tags :text="`${item.value}`" :plain="!item.checked" type="info" :name="index" class="mr-10"
@click="radioClick">
</uv-tags>
</view>
</view>
<view class="flex" v-else>
<view class="web-text-secondary w-15p">已选</view>
<uv-text class="web-text-heading" type="warning" plain :text="skuText" />
</view>
</template>
<template v-slot:value>
<uv-icon name="arrow-right" color="#cccccc"></uv-icon>
</template>
</uv-cell>
<uv-cell :cellStyle="{padding: '10px 5px'}">
<template v-slot:title>
<view class="flex">
<view class="web-text-secondary w-15p">配送</view>
<view class="web-text-heading">啦啦</view>
</view>
</template>
<template v-slot:value>
<uv-icon name="arrow-right" color="#cccccc"></uv-icon>
</template>
</uv-cell>
<uv-cell :border="false" :cellStyle="{padding: '10px 5px'}">
<template v-slot:title>
<view class="flex">
<view class="web-text-secondary w-15p">保障</view>
<view class="web-text-heading value">坏了包赔 假一赔十 七天无理由</view>
</view>
</template>
<template v-slot:value>
<uv-icon name="arrow-right" color="#cccccc"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card title="商品详情" :is-shadow="false" :border="false" :padding="0">
<view class="web-text-heading booking-content">
<view v-html="form.content"></view>
@@ -103,7 +148,7 @@
</uv-cell-group>
<view class="flex m-20 justify-between items-center">
<view class="total-price web-text-heading">
总计{{ isNew }}
总计
<text class="text-red-500" style="font-weight: 500; font-size: 36rpx">¥{{ form.price }}</text>
</view>
<view class="add-cart">
@@ -156,6 +201,7 @@ import {
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import UvButton from "@/uni_modules/uv-button/components/uv-button/uv-button.vue";
import UvText from "@/uni_modules/uv-text/components/uv-text/uv-text.vue";
const cartStore = useCartStore();
const {
@@ -173,7 +219,7 @@ const {
} = storeToRefs(cartStore)
export default {
components: {UvButton, UvGap, UvAvatar},
components: {UvText, UvButton, UvGap, UvAvatar},
data() {
return {
id: 0,
@@ -247,7 +293,7 @@ export default {
});
// 请求数据
Promise.all([app.getGoods(), app.listCart()]).then(data => {
Promise.all([app.getGoods(), app.listCart()]).then(data => {
const form = data[0]
form.content = this.formatRichText(form.content)
app.form = form;
@@ -268,7 +314,7 @@ export default {
app.cart = data[1]
console.log(app.cart.totalNums)
// 更新购物车角标
if(app.cart?.totalNums){
if (app.cart?.totalNums) {
app.options[1].info = app.cart.totalNums
}
})
@@ -353,6 +399,9 @@ export default {
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
openSpecForm(){
this.$refs.specForm.open('center');
},
onClick({index, content}) {
console.log(index, content)
// 客服按钮
@@ -433,6 +482,7 @@ export default {
})
}
},
gotoBuy() {
const app = this
this.disabled = !this.disabled;
@@ -441,15 +491,14 @@ export default {
spec: app.skuText,
cartNum: 1,
isNew: app.isNew
}).then(data => {
app.options[1].info = data.totalNums
}).then(cardId => {
if (app.isNew) {
// CartApi.removeCart(data.id)
// 跳转页面
uni.navigateTo({
url: `/package/goods/checkout?id=${data.id}`
url: `/package/goods/checkout?id=${cardId}`
})
}else {
} else {
}
})
+307
View File
@@ -0,0 +1,307 @@
<template>
<view class="waterfall">
<!-- search-->
<view class="search" style="padding: 0 10rpx; background-color: #FFFFFF">
<uni-search-bar radius="5" placeholder="搜索商品" v-model="where.keywords" clearButton="auto" cancelButton="none" @confirm="search"/>
</view>
<!-- 推荐美食 -->
<ws-goods :goods="goods" />
</view>
</template>
<script>
import * as GoodsApi from '@/api/shop/goods';
import * as GoodsCategoryApi from '@/api/shop/goodsCategory';
import {
guid
} from '@/uni_modules/uv-ui-tools/libs/function/index.js'
import {
useTenantStore
} from '@/store/modules/tenant';
import {getIndex} from "@/api/cms/mp";
const tenantStore = useTenantStore();
export default {
data() {
return {
where: {
},
goods: [],
foods: [],
goodsList: [], // 瀑布流全部数据
list1: [], // 瀑布流第一列数据
list2: [], // 瀑布流第二列数据
goodsCategoryList: [], // 商品分类
leftGap: 10,
rightGap: 10,
columnGap: 10,
// 小程序导航图标
navigation: [],
// 骨架屏
hideTools: true,
// 商品分类
categoryId: undefined
}
},
computed: {
imageStyle(item) {
return item => {
const v = uni.upx2px(750) - this.leftGap - this.rightGap - this.columnGap;
const w = v / 2;
const rate = w / item.w;
const h = rate * item.h;
return {
width: w + 'px',
height: h + 'px'
}
}
}
},
async onLoad({keywords}) {
if(keywords){
this.where.keywords = keywords
uni.setNavigationBarTitle({
title: '商品搜索'
})
}
// 请求数据
await this.reload()
},
methods: {
async reload() {
const app = this
// 获取服务租户信息包
const info = await tenantStore.fetchTenantInfo();
await this.getIndexData()
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true;
}
// 请求数据
Promise.all([app.pageGoods(),app.getGoodsCategory(), app.getIndexData()])
.then((res) => {
app.goodsList = res[0];
app.goodsCategoryList = res[1];
app.hideTools = false
if(res[2]){
app.foods = res[2]?.foods;
app.goods = res[2]?.goods;
}
})
},
getIndexData(){
const app = this;
return new Promise((resolve, reject) => {
getIndex({})
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
pageGoods() {
const app = this
const { categoryId } = this
return new Promise((resolve, reject) => {
GoodsApi.pageGoods(app.where)
.then(result => {
resolve(result.list)
})
.catch(reject)
})
},
getGoodsCategory(){
const app = this
return new Promise((resolve, reject) => {
GoodsCategoryApi.pageGoodsCategory({parentId: 0})
.then(result => {
resolve(result.list)
})
.catch(reject)
})
},
navTo(item) {
uni.navigateTo({
url: '/package/goods/detail?id=' + item.goodsId
})
},
onCategory(item){
this.categoryId = item.categoryId
this.goodsList = []
this.list1 = []
this.list2 = []
this.reload()
},
// 这点非常重要:e.name在这里返回是list1或list2,要手动将数据追加到相应列
changeList(e) {
console.log('e: ', e);
this[e.name].push(e.value);
},
// 模拟的后端数据
getData() {
return new Promise((resolve) => {
const imgs = [{
url: 'https://via.placeholder.com/100x110.png/3c9cff/fff',
width: 100,
height: 110
},
{
url: 'https://via.placeholder.com/200x220.png/f9ae3d/fff',
width: 200,
height: 220
},
{
url: 'https://via.placeholder.com/300x340.png/5ac725/fff',
width: 300,
height: 340
},
{
url: 'https://via.placeholder.com/400x400.png/f56c6c/fff',
width: 400,
height: 400
},
{
url: 'https://via.placeholder.com/500x510.png/909399/fff',
width: 500,
height: 510
},
{
url: 'https://via.placeholder.com/600x606.png/3c9cff/fff',
width: 600,
height: 606
},
{
url: 'https://via.placeholder.com/310x422.png/f1a532/fff',
width: 310,
height: 422
},
{
url: 'https://via.placeholder.com/320x430.png/3c9cff/fff',
width: 320,
height: 430
},
{
url: 'https://via.placeholder.com/330x424.png/f9ae3d/fff',
width: 330,
height: 424
},
{
url: 'https://via.placeholder.com/340x435.png/5ac725/fff',
width: 340,
height: 435
},
{
url: 'https://via.placeholder.com/350x440.png/f56c6c/fff',
width: 350,
height: 440
},
{
url: 'https://via.placeholder.com/380x470.png/909399/fff',
width: 380,
height: 470
}
];
let list = [];
const doFn = (i) => {
const randomIndex = Math.floor(Math.random() * 10);
return {
id: guid(),
allowEdit: i == 0,
image: imgs[randomIndex].url,
w: imgs[randomIndex].width,
h: imgs[randomIndex].height,
title: i % 2 == 0 ? `(${this.list.length + i + 1})体验uv-ui框架` :
`(${this.list.length + i +1})uv-ui支持多平台`,
desc: i % 2 == 0 ? `(${this.list.length + i + 1})欢迎使用uv-ui,uni-app生态专用的UI框架` :
`(${this.list.length + i})开发者编写一套代码, 可发布到iOS、Android、H5、以及各种小程序`
}
};
// 模拟异步
setTimeout(() => {
for (let i = 0; i < 20; i++) {
list.push(doFn(i));
}
resolve({
data: list
});
}, 200)
})
}
}
}
</script>
<style>
page {
/* background: url('https://oss.wsdns.cn/20240505/eaa18a0271fa42aa8395bd5eb874808a.png') no-repeat; */
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style scoped lang="scss">
$show-lines: 1;
@import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
.waterfall-item {
overflow: hidden;
margin-top: 10px;
border-radius: 6px;
&__image {
background-color: #fff;
}
}
.waterfall-item__ft {
padding: 20rpx;
background: #fff;
&__title {
margin-bottom: 10rpx;
line-height: 48rpx;
font-weight: 700;
.value {
font-size: 32rpx;
color: #303133;
}
}
&__desc .value {
font-size: 28rpx;
color: #606266;
}
&__btn {
padding: 10px 0;
}
}
.user-oreder {
width: 720rpx;
margin: 20rpx auto 8rpx auto;
padding: 28rpx 0;
border-radius: 16rpx;
background: #fff;
.web-cell-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.web-text-center {
text-align: center;
}
}
</style>
+293
View File
@@ -0,0 +1,293 @@
<template>
<view class="page">
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`${formData.name ? formData.name : '请填写开票信息'}`"
:label="`${formData.isCompany == 1 ? '单位' : '个人'}`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="editInvoice"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card v-if="formData.name" :border="false" :is-shadow="false" :padding="20">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="100" label-position="left">
<uni-forms-item label="发票类型" name="type">
<uni-data-checkbox v-model="formData.type" :localdata="type" />
</uni-forms-item>
<uni-forms-item label="开票类型" name="invoiceType">
<uni-data-checkbox v-model="formData.invoiceType" :localdata="invoiceType" />
</uni-forms-item>
<block v-if="formData.isCompany == 0">
<uni-forms-item label="名称" name="name" required>
<uv-input class="input" disabled v-model="formData.name" type="text" />
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input class="input" disabled v-model="formData.phone" type="text" placeholder="手机号码" />
</uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required>
<uv-input class="input" disabled v-model="formData.email" type="text" placeholder="电子邮箱" />
</uni-forms-item>
</block>
<block v-if="formData.isCompany == 1">
<uni-forms-item label="名称" name="name" required>
<uv-input class="input" v-model="formData.name" type="text" placeholder="单位名称(必填)" />
</uni-forms-item>
<uni-forms-item label="税号" name="invoiceCode" required>
<uv-input class="input" v-model="formData.invoiceCode" type="text" placeholder="纳税人识别号(必填)" />
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码" />
</uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required>
<uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱" />
</uni-forms-item>
<uni-forms-item label="开户行" name="bankName" required>
<uv-input class="input" v-model="formData.bankName" type="text" placeholder="开户银行名称" />
</uni-forms-item>
<uni-forms-item label="银行账号" name="bankAccount" required>
<uv-input class="input" v-model="formData.bankAccount" type="text" placeholder="开户银行账号" />
</uni-forms-item>
<uni-forms-item label="单位地址" name="address" required>
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址" />
</uni-forms-item>
<uni-forms-item label="单位电话" name="tel" required>
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话" />
</uni-forms-item>
<uni-forms-item label="备注" name="comments">
<uv-textarea v-model="formData.comments" placeholder="请输入备注信息" auto-height></uv-textarea>
</uni-forms-item>
</block>
<uv-button
class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="确认开票"
@click="submit"
></uv-button>
</uni-forms>
</uni-card>
</view>
</template>
<script>
import { useUserStore } from '@/store/modules/user';
import * as Api from '@/api/booking/userInvoice';
import { openUrl } from '@/utils/common';
import { useTenantStore } from '@/store/modules/tenant';
const tenantStore = useTenantStore();
const userStore = useUserStore();
export default {
data() {
return {
orderId: 0,
list: [],
statusBarHeight: 104,
isLogin: false,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
// 表单数据
formData: {
type: 0,
invoiceType: 0
},
// 发票类型
type: [
{
text: '电子',
value: 0
},
{
text: '纸质',
value: 1
}
],
// 开票类型
invoiceType: [
{
text: '普票',
value: 0
},
{
text: '专票',
value: 1
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [
{
required: true,
errorMessage: '请输入开票名称'
}
]
},
// 对email字段进行必填验证
email: {
rules: [
{
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}
]
}
}
};
},
onLoad(e){
this.orderId = e.id
},
onShow() {
this.reload();
},
methods: {
async reload(e) {
const app = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
} else {
app.isLogin = false;
}
// 读取最后一次
Api.pageUserInvoice({
userId: userInfo.userId,
limit: 1
}).then((res) => {
if (res.count > 0 && !app.formData.id) {
app.formData = res.list[0];
app.formData.orderId = app.orderId
}
});
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
openUrl(item);
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
editInvoice(){
uni.navigateTo({
url: `/package/user/invoice-edit?id=${this.formData.id}`
})
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
Api.removeUserInvoice(item.id).then((res) => {
uni.showToast({
title: '操作成功',
icon: 'none'
});
});
app.reload();
}
}
});
},
/**
* 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法
* @param {String} name 字段名称
* @param {String} value 表单域的值
*/
// binddata(name,value){
// // 通过 input 事件设置表单指定 name 的值
// this.$refs.form.setValue(name, value)
// },
// 触发提交表单
submit() {
const { formData } = this
this.$refs.form
.validate()
.then((res) => {
Api.doInvoice(formData)
.then((message) => {
console.log('message: ',message);
uni.showToast({
title: '开票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack()
},1000)
})
.catch((err) => {
console.log(err);
});
console.log('表单数据信息:', res);
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss">
.avatar {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
}
.add-emergency {
width: 500rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
</style>
+8 -1
View File
@@ -81,6 +81,13 @@
</view>
</template>
</uni-list-item>
<uni-list-item link @click="navTo(`/package/user/card-detail-invoice?id=${form.id}`)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">申请开票</text>
</view>
</template>
</uni-list-item>
</uni-list>
</view>
</uni-card>
@@ -162,7 +169,7 @@ export default {
Api.getUserCard(id).then((data) => {
app.form = data;
});
},
onDisabled() {
+267
View File
@@ -0,0 +1,267 @@
<template>
<view class="page">
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`场地发票`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="switchTabTo(`/pages/order`)"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`租赁发票`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="navTo(`/package/user/card`)"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`商城发票`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="navTo(`/package/goods/order`)"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
</view>
</template>
<script>
import {useUserStore} from '@/store/modules/user';
import * as Api from '@/api/booking/userInvoice';
import {openUrl} from '@/utils/common';
import {useTenantStore} from '@/store/modules/tenant';
const tenantStore = useTenantStore();
const userStore = useUserStore();
export default {
data() {
return {
orderId: 0,
list: [],
statusBarHeight: 104,
isLogin: false,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
// 表单数据
formData: {
type: 0,
invoiceType: 0
},
// 发票类型
type: [
{
text: '电子',
value: 0
},
{
text: '纸质',
value: 1
}
],
// 开票类型
invoiceType: [
{
text: '普票',
value: 0
},
{
text: '专票',
value: 1
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [
{
required: true,
errorMessage: '请输入开票名称'
}
]
},
// 对email字段进行必填验证
email: {
rules: [
{
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}
]
}
}
};
},
onLoad(e) {
this.orderId = e.id
},
onShow() {
this.reload();
},
methods: {
async reload(e) {
const app = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
} else {
app.isLogin = false;
}
// 读取最后一次
Api.pageUserInvoice({
userId: userInfo.userId,
limit: 1
}).then((res) => {
if (res.count > 0 && !app.formData.id) {
app.formData = res.list[0];
app.formData.orderId = app.orderId
}
});
},
navTo(url) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.navigateTo({url});
},
switchTabTo(url){
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.switchTab({url})
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
editInvoice() {
uni.navigateTo({
url: `/package/user/invoice-edit?id=${this.formData.id}`
})
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
Api.removeUserInvoice(item.id).then((res) => {
uni.showToast({
title: '操作成功',
icon: 'none'
});
});
app.reload();
}
}
});
},
/**
* 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法
* @param {String} name 字段名称
* @param {String} value 表单域的值
*/
// binddata(name,value){
// // 通过 input 事件设置表单指定 name 的值
// this.$refs.form.setValue(name, value)
// },
// 触发提交表单
submit() {
const {formData} = this
this.$refs.form
.validate()
.then((res) => {
Api.doInvoice(formData)
.then((message) => {
console.log('message: ', message);
uni.showToast({
title: '开票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack()
}, 1000)
})
.catch((err) => {
console.log(err);
});
console.log('表单数据信息:', res);
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss">
.avatar {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
}
.add-emergency {
width: 500rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
</style>
+22 -1
View File
@@ -63,10 +63,17 @@
"enablePullDownRefresh": false
}
},
{
"path": "user/invoice-type",
"style": {
"navigationBarTitleText": "开票类型",
"enablePullDownRefresh": false
}
},
{
"path": "user/invoice",
"style": {
"navigationBarTitleText": "开票发票",
"navigationBarTitleText": "发票开具",
"enablePullDownRefresh": false
}
},
@@ -84,6 +91,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "user/card-detail-invoice",
"style": {
"navigationBarTitleText": "发票开具",
"enablePullDownRefresh": false
}
},
{
"path": "user/balance-log",
"style": {
@@ -168,6 +182,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "goods/index",
"style": {
"navigationBarTitleText": "商品列表",
"enablePullDownRefresh": false
}
},
{
"path": "goods/detail",
"style": {
+387 -386
View File
@@ -1,413 +1,414 @@
<template>
<view>
<view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"
inActiveColor="#808080" @clickItem="onClickItem" />
</view>
<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">
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<text class="merchant-name">{{ item.merchantName }}</text>
</view>
<block v-if="item.orderStatus == 2">
<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>
</view>
</block>
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<block v-for="(sub,subIndex) in item.orderInfo" :key="subIndex">
<uv-cell :title="`${sub.fieldName}`" :label="`${sub.comments}`"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"
@click="openUrl(`/package/order/detail?id=${item.orderId}`)" />
</block>
</uv-cell-group>
<view class="total-price">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
<view class="web-text-heading" style="font-weight: 500;">
实付:¥{{ item.payPrice }}</view>
</view>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="card-actions-item" v-if="item.payStatus == 0 && item.orderStatus == 0">
<button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">取消订单</button>
<button class="mini-btn" type="primary" size="mini"
@click="toPay(item.orderId)">去支付</button>
</view>
<view class="card-actions-item" v-if="item.payStatus == 1">
<button class="mini-btn" size="mini" v-if="item.isInvoice == 0" @click="onInvoice(item.orderId)">申请开票</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.orderId)">查看发票</button>
</view>
</view>
</uni-card>
</block>
</block>
<block v-if="orderList.length == 0 && loadMore != 'no-more'">
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false">
</uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false">
</uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false">
</uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
<uni-card :border="false" :padding="'18px 6px'">
<uv-skeleton rows="3" avatar :loading="hideTools" :title="false">
</uv-skeleton>
<uv-gap height="16"></uv-gap>
</uni-card>
</block>
<uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<view>
<view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"
inActiveColor="#808080" @clickItem="onClickItem"/>
</view>
<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">
<view class="merchant-avatar">
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<text class="merchant-name">{{ item.merchantName }}</text>
</view>
<block v-if="item.orderStatus == 2">
<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>
</view>
</block>
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<block v-for="(sub,subIndex) in item.orderInfo" :key="subIndex">
<uv-cell :title="`${sub.fieldName}`" :label="`${sub.comments}`"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"
@click="openUrl(`/package/order/detail?id=${item.orderId}`)"/>
</block>
</uv-cell-group>
<view class="total-price">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
<view class="web-text-heading" style="font-weight: 500;">
实付:¥{{ item.payPrice }}
</view>
</view>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="card-actions-item" v-if="item.payStatus == 0 && item.orderStatus == 0">
<button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="toPay(item.orderId)">去支付
</button>
</view>
<view class="card-actions-item" v-if="item.payStatus == 1">
<button class="mini-btn" size="mini" v-if="item.isInvoice == 0" @click="onInvoice(item.orderId)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.orderId)">查看发票</button>
</view>
</view>
</uni-card>
</block>
</block>
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
<!-- <uv-skeleton rows="3" avatar :loading="hideTools" :title="false">-->
<!-- </uv-skeleton>-->
<!-- <uv-gap height="16"></uv-gap>-->
<!-- </uni-card>-->
<!-- </block>-->
<uv-empty :show="orderList.length === 0 && loadMore !== 'no-more'" mode="order" class="none"
icon="https://cdn.uviewui.com/uview/empty/car.png"></uv-empty>
<uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</view>
</view>
</template>
<script>
import * as OrderApi from '@/api/shop/order'
import {
pageWechatDeposit
} from '@/api/shop/wechatDeposit'
import {
getWeek,
getKey
} from '@/utils/common';
import * as OrderApi from '@/api/shop/order'
import {
pageWechatDeposit
} from '@/api/shop/wechatDeposit'
import {
getWeek,
getKey
} from '@/utils/common';
export default {
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1,
type: 1, // 0商城订单 1场地预定
sceneType: 'showOrderInfo' // 查询订单附加场地信息
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderList: [],
styles: [{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
}
},
onLoad(option) {
// 判断是否登录
this.openLogin()
// 加载数据
this.reload()
// if(option.isRefresh){
// this.isRefresh = true
// }
},
onShow(e) {
// 判断是否登录
this.openLogin()
this.reload()
},
// 触底函数
onReachBottom() {
const app = this
const {
where
} = this
if (app.canReset) {
app.where.page = ++where.page;
app.reload()
}
},
methods: {
reload() {
const app = this
const {
where,
userId
} = this
if (userId == 0) {
app.openLogin()
return;
}
where.userId = userId;
// uni.showLoading({
// title: '数据读取中.'
// })
app.loadMore = 'loading'
OrderApi.pageOrder(where).then(res => {
const list = res.list.map(d => {
return d;
});
if (app.orderList.length < res.count) {
console.log('11111: ', 11111);
app.orderList = app.orderList.concat(list)
app.canReset = true
app.loadMore = 'no-more'
} else {
app.canReset = false;
app.loadMore = 'no-more'
console.log('22222: ', 22222);
}
uni.hideLoading()
app.isRefresh = false
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
app.isRefresh = false
})
},
onClickItem(e) {
const app = this
const {
where,
userId
} = this
const index = e.currentIndex
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
if (userId === 0) {
app.openLogin()
return;
}
// 全部
if (index === 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index === 1) {
where.payStatus = 0;
where.orderStatus = undefined;
}
// 已支付
if (index === 2) {
where.payStatus = 1;
}
// 已完成
if (index === 3) {
where.payStatus = 1;
where.orderStatus = 1;
}
// 押金
if (index === 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then(res => {
app.orderList = res.list;
if(res.count == 0){
app.loadMore = 'no-more'
}
uni.hideLoading()
})
return false
}
this.where.page = 1;
this.orderList = [];
this.reload()
},
openUrl(url) {
uni.navigateTo({
url
})
},
toPay(orderId) {
uni.navigateTo({
url: '/package/booking/confirm?id=' + orderId
})
},
closeOrder(item) {
uni.showModal({
title: '确定取消此订单?',
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()
})
}
}
});
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom')
return false;
}
},
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
})
},
showInvoice(id){
uni.navigateTo({
url: `/package/user/invoice-show?id=${id}`
})
}
}
}
export default {
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
where: {
page: 1,
type: 1, // 0商城订单 1场地预定
sceneType: 'showOrderInfo' // 查询订单附加场地信息
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderList: [],
styles: [{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
}
},
onLoad(option) {
// 加载数据
this.reload()
// if(option.isRefresh){
// this.isRefresh = true
// }
},
onShow(e) {
this.reload()
},
// 触底函数
onReachBottom() {
const app = this
const {
where
} = this
if (app.canReset) {
app.where.page = ++where.page;
app.reload()
}
},
methods: {
async reload() {
const app = this
const { where } = this
app.userId = await uni.getStorageSync('user_id')
if (app.userId === 0 || app.userId === undefined) {
app.orderList = [];
app.loadMore = 'no-more'
return;
}
where.userId = app.userId;
app.loadMore = 'loading'
OrderApi.pageOrder(where).then(res => {
const list = res.list.map(d => {
return d;
});
if (app.orderList.length < res.count) {
app.orderList = app.orderList.concat(list)
app.canReset = true
app.loadMore = 'no-more'
} else {
app.canReset = false;
app.loadMore = 'no-more'
}
uni.hideLoading()
app.isRefresh = false
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
app.isRefresh = false
})
},
onClickItem(e) {
const app = this
const {
where,
userId
} = this
if (userId === 0) {
app.orderList = [];
app.loadMore = 'no-more'
return;
}
const index = e.currentIndex
if (this.current !== e.currentIndex) {
this.current = e.currentIndex
}
// 全部
if (index === 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index === 1) {
where.payStatus = 0;
where.orderStatus = undefined;
}
// 已支付
if (index === 2) {
where.payStatus = 1;
}
// 已完成
if (index === 3) {
where.payStatus = 1;
where.orderStatus = 1;
}
// 押金
if (index === 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then(res => {
app.orderList = res.list;
if (res.count == 0) {
app.loadMore = 'no-more'
}
uni.hideLoading()
})
return false
}
this.where.page = 1;
this.orderList = [];
this.reload()
},
openUrl(url) {
uni.navigateTo({
url
})
},
toPay(orderId) {
uni.navigateTo({
url: '/package/booking/confirm?id=' + orderId
})
},
closeOrder(item) {
uni.showModal({
title: '确定取消此订单?',
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()
})
}
}
});
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom')
return false;
}
},
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
})
},
showInvoice(id) {
uni.navigateTo({
url: `/package/user/invoice-show?id=${id}`
})
}
}
}
</script>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.segmented {
padding: 0 12rpx;
}
.segmented {
padding: 0 12rpx;
}
.content-text {
font-size: 14px;
color: #666;
}
.content-text {
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
}
.color-tag {
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
}
.uni-list {
flex: 1;
}
.order {
.order-title {
.order {
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.order-body {
padding: 16px 0;
}
}
.ele-flex {
display: flex;
justify-content: space-between;
}
.ele-flex {
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.close {
top: 60rpx !important;
}
.close {
top: 60rpx !important;
}
.total-price {
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 30rpx;
align-items: flex-start;
padding-left: 6rpx;
margin-left: 450rpx;
.total-price {
display: flex;
flex-direction: column;
justify-content: flex-start;
font-size: 30rpx;
align-items: flex-start;
padding-left: 6rpx;
margin-left: 450rpx;
.web-text-heading {
font-size: 30rpx !important;
}
}
.web-text-heading {
font-size: 30rpx !important;
}
}
</style>
+3 -2
View File
@@ -12,7 +12,7 @@
<!-- search-->
<view class="search" style="padding: 0 10rpx; background-color: #FFFFFF">
<uni-search-bar radius="5" placeholder="搜索商品" clearButton="auto" cancelButton="none" @confirm="search"/>
<uni-search-bar radius="5" placeholder="搜索商品" v-model="keywords" clearButton="auto" cancelButton="none" @confirm="search"/>
</view>
<!-- <uv-gap height="8"></uv-gap>-->
@@ -193,6 +193,7 @@ export default {
showSpecForm: false,
sku: [],
skuText: '',
keywords: '',
disabled: false,
// 支付密码是否正确
isPayPasswordCorrect: false,
@@ -328,7 +329,7 @@ export default {
},
search(){
uni.navigateTo({
url: '/package/goods/index?keywords=' + this.goods.goodsId
url: '/package/goods/index?keywords=' + this.keywords
})
},
save() {
+50 -21
View File
@@ -66,20 +66,39 @@
<!-- </uni-card>-->
<block v-for="(item, index) in mpMenus" :key="index">
<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>{{ item.title }}</text>
</div>
</block>
</div>
<w-gap height="5"></w-gap>
</uv-skeleton>
</uni-card>
<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)">
<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 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" />-->
@@ -103,6 +122,7 @@ import {getWxOpenId} from '@/api/passport/login';
import Layout from "@/components/layout.vue";
import {useTenantStore} from '@/store/modules/tenant';
import {authUser} from "@/api/user";
const tenantStore = useTenantStore();
const mpStore = useMpStore();
@@ -175,17 +195,26 @@ export default {
app.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
// 获取用户副表信息
UserApi.getByPhone({
phone: userInfo.phone
await UserApi.getByPhone({
openId: userInfo.openid
}).then((data) => {
if (data) {
app.users = data;
uni.setStorageSync('uid', data.id);
app.userInfo = Object.assign({}, app.userInfo, data);
if (!data.openId) {
data.openId = app.userInfo.openid
updateUsers(data);
}
data.points = data.integral
data.balance = data.money
data.isAdmin = 2 === data.isAdmin
data.idCardNo = data.idCard
data.nickname = data.username
data.avatar = data.avatarUrl
data.createTime = uni.$uv.date(data.createTime,'yyyy-mm-dd hh:MM:ss')
authUser(data)
// app.userInfo = Object.assign({}, app.userInfo, data);
// if (!data.openId) {
// data.openId = app.userInfo.openid
// updateUsers(data);
// }
}
});
+4 -1
View File
@@ -21,7 +21,10 @@ export const useMpStore = defineStore({
* 请求用户信息、权限、角色、菜单
*/
async fetchMpInfo() {
const info = await getMpInfo().catch(() => void 0);
const info = await getMpInfo().catch((err => {
console.log(err.code,'fetchMpInfo()')
uni.clearStorageSync()
}));
if (!info) {
return {};
}
@@ -1,37 +1,26 @@
<template>
<view class="waterfall">
<!-- <view class="category-top" style="background-color: #FFFFFF; height: 40px; padding-top: 10rpx;">-->
<!-- <view class="category-top-gray" style="margin-top: 30rpx;width: 750rpx;height: 40rpx; background-color: #f0f2f5; border-radius: 40rpx 40rpx 0 0;"></view>-->
<!-- </view>-->
<view class="category">
<view class="category-bar flex justify-between pt-20">
<view class="item comprehensive" v-for="(item,index) in category" :key="index">
<view :class="item.selected ? 'selected' : 'select'" :style="`background: url(${config.indexGoodsNavBg})`">
<view class="title">{{ title ? title : item.name }}</view>
</view>
</view>
<!-- <view class="flex items-center">-->
<!-- <ws-data-select-->
<!-- v-model="value"-->
<!-- placeholder="综合"-->
<!-- :localdata="range"-->
<!-- @change="change"-->
<!-- ></ws-data-select>-->
<!-- <view class="category">-->
<!-- <view class="category-bar flex justify-between pt-20">-->
<!-- <view class="item comprehensive" v-for="(item,index) in category" :key="index">-->
<!-- <view :class="item.selected ? 'selected' : 'select'" :style="`background: url(${config.indexGoodsNavBg})`">-->
<!-- <view class="title">{{ title ? title : item.name }}</view>-->
<!-- </view>-->
<!-- </view>-->
<view class="flex items-center">
<text style="font-size: 22rpx; margin-right: 10rpx;">综合</text>
<uv-icon name="arrow-down" size="14"></uv-icon>
</view>
<view class="flex items-center">
<text style="font-size: 22rpx; margin-right: 10rpx;">销量</text>
<uv-icon name="arrow-down" size="14"></uv-icon>
</view>
<view class="flex items-center">
<text style="font-size: 22rpx;margin-right: 10rpx;">价格</text>
<uv-icon name="arrow-down"></uv-icon>
</view>
</view>
</view>
<!-- <view class="flex items-center">-->
<!-- <text style="font-size: 22rpx; margin-right: 10rpx;">综合</text>-->
<!-- <uv-icon name="arrow-down" size="14"></uv-icon>-->
<!-- </view>-->
<!-- <view class="flex items-center">-->
<!-- <text style="font-size: 22rpx; margin-right: 10rpx;">销量</text>-->
<!-- <uv-icon name="arrow-down" size="14"></uv-icon>-->
<!-- </view>-->
<!-- <view class="flex items-center">-->
<!-- <text style="font-size: 22rpx;margin-right: 10rpx;">价格</text>-->
<!-- <uv-icon name="arrow-down"></uv-icon>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<view class="goods-list m-a flex justify-between flex-1">
<block v-for="(item, index) in goods" :key="index">
<view class="goods-item bg-white flex" @click="navTo(item)">
@@ -1,19 +1,9 @@
<template>
<uni-popup ref="login" type="top" safeArea backgroundColor="#fff">
<view class="login-model">
<!-- #ifdef MP-WEIXIN -->
<view class="close web-text-secondary" :style="'top:'+ (statusBarHeight-18)+'px'" @click="closeLogin">
<uv-icon name="close-circle" size="30"></uv-icon>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="close-h5 web-text-secondary" :style="'top:'+ (statusBarHeight-18)+'px'" @click="closeLogin">
<uv-icon name="close-circle" size="30"></uv-icon>
</view>
<!-- #endif -->
<view class="center">
<view class="center relative">
<view class="logo">
<image :src="config.loginLogo" mode="widthFix"></image>
<uv-avatar :src="config.loginLogo" size="90" shape="square"></uv-avatar>
</view>
<view class="logo-desc">
<view class="title">
@@ -85,6 +75,9 @@
</view>
</view>
</view>
<view class="close text-gray-800" @click="closeLogin">
<uv-icon name="close-circle" size="30"></uv-icon>
</view>
</view>
</view>
</uni-popup>
@@ -361,7 +354,6 @@ export default {
justify-content: center;
.center {
height: 60vh;
.logo {
margin: 0 auto;
@@ -416,19 +408,13 @@ export default {
}
.close {
position: fixed;
top: 50rpx;
left: 0rpx;
width: 750rpx;
position:fixed;
bottom: 100rpx;
text-align: center;
display: flex;
justify-content: center;
z-index: 9999;
padding: 24rpx;
}
.close-h5 {
position: fixed;
top: 100rpx !important;
left: 0rpx;
z-index: 9999;
padding: 24rpx;
}
.login-btn {