重构框架

This commit is contained in:
2024-08-14 06:39:28 +08:00
parent 24e63cf551
commit 10533eb67d
166 changed files with 11388 additions and 856 deletions
+49 -43
View File
@@ -1,37 +1,38 @@
<template>
<view class="order" v-if="form.orderId">
<view class="qrcode" v-if="form.payStatus == 1 && form.orderStatus == 0">
<uv-qrcode
ref="qrcode"
size="280rpx"
:options="{
data: form.orderNo,
foregroundImageSrc: form.merchantAvatar,
margin: 10,
foregroundImagePadding: 4,
foregroundImageHeight: 30,
foregroundImageWidth: 30,
foregroundImageBorderRadius: 4
}"
:value="`${h5_url}#/package/admin/order-scan?orderNo=${form.orderNo}`"
></uv-qrcode>
<view class="order" v-if="form.id">
<view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2">
<uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200" />
<!-- <uv-qrcode-->
<!-- ref="qrcode"-->
<!-- size="280rpx"-->
<!-- :options="{-->
<!-- data: form.orderNum,-->
<!-- foregroundImageSrc: form.merchantAvatar,-->
<!-- margin: 10,-->
<!-- foregroundImagePadding: 4,-->
<!-- foregroundImageHeight: 30,-->
<!-- foregroundImageWidth: 30,-->
<!-- foregroundImageBorderRadius: 4-->
<!-- }"-->
<!-- :value="`${h5_url}#/package/admin/order-scan?orderNo=${form.orderNum}`"-->
<!-- ></uv-qrcode>-->
<text class="web-text-secondary">核销码</text>
</view>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<block v-for="(item, index) in form.orderInfo" :key="index">
<uv-cell :title="`${form.siteName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<block v-for="(item, index) in form.thinkOrderInfos" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.comments}`"
:label="`${item.dateTime}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:value="`¥${item.price}`"
:border="item.isChildren"
:border="item.isChildren === 1"
/>
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren === 1" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren === 1" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
</block>
</uv-cell-group>
</view>
@@ -41,30 +42,26 @@
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNo">
<block v-if="form.orderNum">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.realName}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`姓名`" :value="`${form.name}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单号`" :value="`${form.orderId}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单编号`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<uv-parse :content="form.orderNo" :selectable="true"></uv-parse>
</template>
</uv-cell>
<uv-cell :title="`订单号`" :value="`${form.id}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单编号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"" />
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.payStatus == 0">
<view v-if="form.payStatus === 0">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`下单时间`" :value="`${timeFormat(form.createTime,'yyyy-mm-dd hh:MM:ss')}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`优惠说明`" :value="`${form.couponDesc ? form.couponDesc : '无'}`" :cellStyle="{ padding: '8px' }" :border="false" />
<uv-cell :title="`优惠说明`" :value="`${form.desc ? form.desc : '无'}`" :cellStyle="{ padding: '8px' }" :border="false" />
</uv-cell-group>
</view>
</uni-card>
@@ -88,11 +85,15 @@
</template>
<script>
import * as OrderApi from '@/api/shop/order';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit';
import * as OrderApi from '@/api/think/thinkOrder';
import { IMG_URL } from '@/config/setting';
import { pageThinkWechatDeposit } from '@/api/think/thinkWechatDeposit';
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import {timeFormat} from "@/uni_modules/uv-ui-tools/libs/function";
import { copyText, openUrl } from '@/utils/common';
export default {
components: {},
components: {UvImage},
data() {
return {
isLogin: false,
@@ -127,6 +128,7 @@ export default {
'VIP季卡',
'IC季卡'
],
IMG_URL,
orderList: [],
styles: [
{
@@ -168,23 +170,24 @@ export default {
}
},
methods: {
timeFormat,
reload() {
const app = this;
const { where, userId, orderId } = this;
if (userId == 0) {
if (!uni.getStorageSync('user_id')) {
app.openLogin();
return;
}
where.userId = userId;
where.uid = uni.getStorageSync('uid');
uni.showLoading({
title: '数据读取中.'
});
OrderApi.getOrder(orderId).then((data) => {
console.log('data: ', data);
OrderApi.getThinkOrder(orderId).then((data) => {
console.log('data909090: ', data);
app.form = data;
// 页面标题
if (data.orderStatus == 1) {
if (data.orderStatus === 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
@@ -207,6 +210,9 @@ export default {
url
});
},
onCopyText(text){
copyText(text);
},
onClickItem(e) {
const app = this;
const { where, userId } = this;
@@ -237,8 +243,8 @@ export default {
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
pageThinkWechatDeposit({
uid: uni.getStorageSync('uid')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
+378 -363
View File
@@ -1,384 +1,399 @@
<template>
<view class="page">
<!-- 其他功能 -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<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="(item,index) in list" :key="index">
<uv-cell :cellStyle="{padding: '10px 0'}" :label="item.address">
<template v-slot:icon>
<uv-avatar :text="item.type" fontSize="12" size="32" randomBgColor></uv-avatar>
</template>
<template v-slot:title>
<view class="title-bar">
<text class="web-text-heading" style="font-weight: 700;">{{ item.name }}</text>
<text class="web-text-secondary">{{ item.phone }}</text>
<uni-tag v-if="item.isDefault" text="默认" size="mini" inverted type="success"></uni-tag>
</view>
</template>
<template v-slot:right-icon>
<uni-icons type="compose" style="color: #999999;" size="18"
@click="openEdit(item)"></uni-icons>
</template>
</uv-cell>
</block>
</uv-cell-group>
</view>
</view>
</uni-card>
<view class="btn-bar">
<uv-button class="save-user-profile"
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="添加收货地址" @click="add"></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
<!-- addressEdit弹窗 -->
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="添加收货地址" :border="false" :is-shadow="false" :padding="'10px 6px'">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
<uni-forms-item label="收件人" name="name" required>
<uv-input placeholder="收件人姓名" v-model="formData.name" maxlength="5"></uv-input>
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input placeholder="收件人手机号码" v-model="formData.phone" maxlength="11"></uv-input>
</uni-forms-item>
<uni-forms-item label="所在地区" name="region" required>
<uni-data-picker placeholder="省、市、区、街道" popup-title="请选择所在地区" :localdata="regions"
:map="{text:'label',value: 'value'}" v-model="formData.region" @change="onchange" @nodeclick="onnodeclick"
@popupopened="onpopupopened" @popupclosed="onpopupclosed">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="详细地址" name="address" required>
<uv-input placeholder="小区、写字楼、门牌号等" v-model="formData.address"></uv-input>
</uni-forms-item>
<uni-forms-item label="标签" name="type">
<uni-data-checkbox mode="tag" v-model="formData.type" :localdata="typeData" @change="onType"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item name="isDefault">
<view class="web-cell">
<uni-data-checkbox v-model="formData.isDefault"
:localdata="defaultData" @click="onIsDefault"></uni-data-checkbox>
<view v-if="formData.id" class="del-btn" @click="remove(formData)">
<uni-icons type="trash" class="web-cell" style="color: #999999;">
<text class="web-text-danger"
style="font-size: 22rpx; padding-left: 4rpx;">删除</text>
</uni-icons>
</view>
</view>
</uni-forms-item>
<view class="page">
<!-- 其他功能 -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<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="(item,index) in list" :key="index">
<uv-cell :cellStyle="{padding: '10px 0'}" :label="item.address">
<template v-slot:icon>
<uv-avatar :text="item.type" fontSize="12" size="32" randomBgColor></uv-avatar>
</template>
<template v-slot:title>
<view class="title-bar">
<text class="web-text-heading" style="font-weight: 700;">{{ item.name }}</text>
<text class="web-text-secondary">{{ item.phone }}</text>
<uni-tag v-if="item.isDefault" text="默认" size="mini" inverted type="success"></uni-tag>
</view>
</template>
<template v-slot:right-icon>
<uni-icons type="compose" style="color: #999999;" size="18"
@click="openEdit(item)"></uni-icons>
</template>
</uv-cell>
</block>
</uv-cell-group>
</view>
</view>
</uni-card>
<view class="btn-bar">
<uv-button class="save-user-profile"
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="添加收货地址" @click="add"></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
<!-- addressEdit弹窗 -->
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="添加收货地址" :border="false" :is-shadow="false" :padding="'10px 6px'">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
<uni-forms-item label="收件人" name="name" required>
<uv-input placeholder="收件人姓名" v-model="formData.name" maxlength="5"></uv-input>
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input placeholder="收件人手机号码" v-model="formData.phone" maxlength="11"></uv-input>
</uni-forms-item>
<uni-forms-item label="所在地区" name="region" required>
<uni-data-picker placeholder="省、市、区、街道" popup-title="请选择所在地区" :localdata="regions"
:map="{text:'label',value: 'value'}" v-model="formData.region" @change="onchange"
@nodeclick="onnodeclick"
@popupopened="onpopupopened" @popupclosed="onpopupclosed">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="详细地址" name="address" required>
<uv-input placeholder="小区、写字楼、门牌号等" v-model="formData.address"></uv-input>
</uni-forms-item>
<uni-forms-item label="标签" name="type">
<uni-data-checkbox mode="tag" v-model="formData.type" :localdata="typeData"
@change="onType"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item name="isDefault">
<view class="web-cell">
<uni-data-checkbox v-model="formData.isDefault"
:localdata="defaultData" @click="onIsDefault"></uni-data-checkbox>
<view v-if="formData.id" class="del-btn" @click="remove(formData)">
<uni-icons type="trash" class="web-cell" style="color: #999999;">
<text class="web-text-danger"
style="font-size: 22rpx; padding-left: 4rpx;">删除
</text>
</uni-icons>
</view>
</view>
</uni-forms-item>
<uv-button class="add-address"
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="保存" @click="submit"></uv-button>
</uni-forms>
</uni-card>
</uni-popup>
</view>
<uv-button class="add-address"
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="保存" @click="submit"></uv-button>
</uni-forms>
</uni-card>
</uni-popup>
</view>
</template>
<script>
import * as Api from '@/api/shop/userAddress';
import * as MpMenuApi from '@/api/cms/mp-menu/index';
import regions from '@/api/regions-data.json';
import {
getWxOpenId
} from '@/api/passport/login';
import {
openUrl
} from '@/utils/common';
import {
useUserStore
} from '@/store/modules/user';
import {
useCarStore
} from '@/store/modules/car';
import * as Api from '@/api/think/thinkUsersAddress';
import regions from '@/api/regions-data.json';
import {
getWxOpenId
} from '@/api/passport/login';
import {
openUrl
} from '@/utils/common';
import {
useUserStore
} from '@/store/modules/user';
import {
useCarStore
} from '@/store/modules/car';
const userStore = useUserStore();
const carStore = useCarStore();
const userStore = useUserStore();
const carStore = useCarStore();
export default {
data() {
return {
list: [],
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
},
// 表单数据
formData: {},
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
defaultData: [{
text: '默认收货地址',
value: true
}],
typeData: [{
text: '家',
value: '家'
},
{
text: '公司',
value: '公司'
},
{
text: '学校',
value: '学校'
}
],
regions,
dataTree: [{
text: "一年级",
value: "1-0",
children: [{
text: "1.1班",
value: "1-1"
},
{
text: "1.2班",
value: "1-2"
}
]
},
{
text: "二年级",
value: "2-0",
children: [{
text: "2.1班",
value: "2-1"
},
{
text: "2.2班",
value: "2-2"
}
]
},
{
text: "三年级",
value: "3-0",
disable: true
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [{
required: true,
errorMessage: '请输入收件人名称',
}]
},
phone: {
rules: [{
required: true,
format: 'number',
errorMessage: '请输入正确的手机号码',
}]
},
address: {
rules: [{
required: true,
errorMessage: '请输入详情地址',
}]
},
region: {
rules: [{
required: true,
errorMessage: '请选择所在地区',
}, {
validateFunction: function(rule, value, data, callback) {
console.log('value: ', value);
if (value.length < 2) {
callback('请至少勾选两个兴趣爱好')
}
return true
}
}]
}
export default {
data() {
return {
list: [],
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
},
// 表单数据
formData: {},
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
defaultData: [{
text: '默认收货地址',
value: true
}],
typeData: [{
text: '家',
value: '家'
},
{
text: '公司',
value: '公司'
},
{
text: '学校',
value: '学校'
}
],
regions,
dataTree: [{
text: "一年级",
value: "1-0",
children: [{
text: "1.1班",
value: "1-1"
},
{
text: "1.2班",
value: "1-2"
}
]
},
{
text: "二年级",
value: "2-0",
children: [{
text: "2.1班",
value: "2-1"
},
{
text: "2.2班",
value: "2-2"
}
]
},
{
text: "三年级",
value: "3-0",
disable: true
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [{
required: true,
errorMessage: '请输入收件人名称',
}]
},
phone: {
rules: [{
required: true,
format: 'number',
errorMessage: '请输入正确的手机号码',
}]
},
address: {
rules: [{
required: true,
errorMessage: '请输入详情地址',
}]
},
region: {
rules: [{
required: true,
errorMessage: '请选择所在地区',
}, {
validateFunction: function (rule, value, data, callback) {
console.log('value: ', value);
if (value.length < 2) {
callback('请至少勾选两个兴趣爱好')
}
return true
}
}]
}
}
}
},
onLoad() {
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
}
}
}
},
onLoad() {
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.pageUserAddress({
userId: userInfo.userId
}).then(res => {
app.list = res.list;
})
// 获取收货地址列表
Api.pageThinkUsersAddress({
uid: uni.getStorageSync('uid')
}).then(res => {
app.list = res.list;
})
// 获取地区选择数据
// this.regions = this.regions.map(d => {
// console.log('d: ',d);
// d.text = d.label
// return d;
// })
// Api.getRegions().then(res => {
// console.log('res: ',res);
// })
},
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;
}
},
onType(e){
this.formData.type = e.detail.value;
},
onIsDefault(){
this.formData.isDefault = !this.formData.isDefault;
},
// 选用该地址
onAddres(item){
carStore.setAddress(item)
uni.navigateBack()
},
add() {
this.formData = {}
this.$refs.addForm.open('center')
},
openEdit(item) {
this.formData = item
this.$refs.addForm.open('center')
},
remove(item) {
const app = this
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
})
Api.removeUserAddress(item.id).then(res => {
uni.showToast({
title: '操作成功',
icon: 'none'
})
app.$refs.addForm.close()
app.reload()
})
app.reload()
}
}
});
// 获取地区选择数据
// this.regions = this.regions.map(d => {
// console.log('d: ',d);
// d.text = d.label
// return d;
// })
// Api.getRegions().then(res => {
// console.log('res: ',res);
// })
},
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;
}
},
onType(e) {
this.formData.type = e.detail.value;
},
onIsDefault() {
this.formData.isDefault = !this.formData.isDefault;
},
// 选用该地址
onAddress(item) {
carStore.setAddress(item)
uni.navigateBack()
},
add() {
this.formData = {}
this.$refs.addForm.open('center')
},
openEdit(item) {
this.formData = item
this.$refs.addForm.open('center')
},
remove(item) {
const app = this
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
})
Api.removeThinkUsersAddress(item.id).then(res => {
uni.showToast({
title: '操作成功',
icon: 'none'
})
app.$refs.addForm.close()
app.reload()
})
app.reload()
}
}
});
},
// 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
const saveOrUpdate = this.formData.id ? Api.updateUserAddress : Api.addUserAddress
saveOrUpdate(this.formData).then(message => {
uni.showToast({
title: '保存成功',
icon: 'success'
})
this.$refs.addForm.close()
this.reload()
}).catch((err) => {
console.log(err);
})
console.log('表单数据信息:', res);
}).catch(err => {
console.log('表单错误信息:', err);
})
},
save() {
Api.addUserAddress(this.form).then(msg => {
uni.showToast({
title: msg,
icon: 'none'
})
this.$refs.addForm.close()
this.reload()
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
this.$refs.addForm.close()
this.reload()
})
}
}
}
},
onchange(e) {
const { value } = e.detail
this.formData.region = value[0].text +','+ value[1].text +','+ value[2].text
},
// 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
const saveOrUpdate = this.formData.id ? Api.updateThinkUsersAddress : Api.addThinkUsersAddress
saveOrUpdate({
...this.formData,
isDefault: this.formData.isDefault ? 1 : 2
}
).then(message => {
uni.showToast({
title: '保存成功',
icon: 'success'
})
this.$refs.addForm.close()
this.reload()
}).catch((err) => {
console.log(err);
})
console.log('表单数据信息:', res);
}).catch(err => {
console.log('表单错误信息:', err);
})
},
save() {
Api.addThinkUsersAddress(
{
...this.formData,
isDefault: this.formData.isDefault ? 1 : 2
}
).then(msg => {
uni.showToast({
title: msg,
icon: 'none'
})
this.$refs.addForm.close()
this.reload()
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
this.$refs.addForm.close()
this.reload()
})
}
}
}
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
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;
}
.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;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
}
.add-address {
width: 600rpx !important;
margin: 40rpx auto;
}
.add-address {
width: 600rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
.title-bar {
display: flex;
.title-bar {
display: flex;
.web-text-heading {
margin-right: 20rpx;
}
.web-text-heading {
margin-right: 20rpx;
}
.web-text-secondary {
margin-right: 20rpx;
}
}
</style>
.web-text-secondary {
margin-right: 20rpx;
}
}
</style>
+14 -14
View File
@@ -6,7 +6,7 @@
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in list" :key="index">
<uv-cell :cellStyle="{ padding: '10px 0' }" :title="item.name" :label="item.phone">
<uv-cell :cellStyle="{ padding: '10px 0' }" :title="item.contractName" :label="item.contractPhone">
<template v-slot:right-icon>
<uv-icon size="40rpx" name="trash" @click="onDel(item)"></uv-icon>
</template>
@@ -30,11 +30,11 @@
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="添加紧急联系人" :border="false" :is-shadow="false" :padding="'10px 6px'">
<uni-forms ref="form" :modelValue="form" :rules="rules" :label-width="80">
<uni-forms-item label="姓名" name="name">
<uv-input placeholder="请输入姓名" v-model="form.name" maxlength="11" :customStyle="{ margin: '10px 0' }"></uv-input>
<uni-forms-item label="姓名" name="contractName">
<uv-input placeholder="请输入姓名" v-model="form.contractName" maxlength="11" :customStyle="{ margin: '10px 0' }"></uv-input>
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone">
<uv-input placeholder="请输入手机号码" v-model="form.phone" maxlength="11" :customStyle="{ margin: '10px 0' }"></uv-input>
<uni-forms-item label="手机号码" name="contractPhone">
<uv-input placeholder="请输入手机号码" v-model="form.contractPhone" maxlength="11" :customStyle="{ margin: '10px 0' }"></uv-input>
</uni-forms-item>
<uv-button
class="add-address"
@@ -50,7 +50,7 @@
<script>
import { useUserStore } from '@/store/modules/user';
import * as Api from '@/api/booking/emergency';
import * as Api from '@/api/think/thinkUsersEmergency';
import * as MpMenuApi from '@/api/cms/mp-menu/index';
import { getWxOpenId } from '@/api/passport/login';
import { openUrl } from '@/utils/common';
@@ -68,12 +68,12 @@ export default {
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
contractName: '',
contractPhone: ''
},
rules: {
// 对name字段进行必填验证
name: {
contractName: {
rules: [
{
required: true,
@@ -87,7 +87,7 @@ export default {
]
},
// 对email字段进行必填验证
phone: {
contractPhone: {
rules: [
{
required: true,
@@ -119,8 +119,8 @@ export default {
}
// 获取联系人列表
Api.pageEmergency({
userId: userInfo.userId
Api.pageThinkUsersEmergency({
uid: uni.getStorageSync('uid')
}).then((res) => {
app.list = res.list;
});
@@ -151,7 +151,7 @@ export default {
uni.showLoading({
title: '请求中.'
});
Api.removeEmergency(item.emergencyId).then((res) => {
Api.removeThinkUsersEmergency(item.id).then((res) => {
uni.showToast({
title: '操作成功',
icon: 'none'
@@ -167,7 +167,7 @@ export default {
this.$refs.form
.validate()
.then((res) => {
Api.addEmergency(this.form)
Api.addThinkUsersEmergency({...this.form,sort: 99})
.then((msg) => {
uni.showToast({
title: msg,
+191 -187
View File
@@ -1,224 +1,228 @@
<template>
<view class="page">
<!-- 其他功能 -->
<view class="ic-card-body web-cell web-cell-align-top">
<view class="web-cell-content"></view>
</view>
<view class="page">
<!-- 其他功能 -->
<view class="ic-card-body web-cell web-cell-align-top">
<view class="web-cell-content"></view>
</view>
<uni-card title="卡片信息" :border="false" :is-shadow="false" :padding="'10px 6px'">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
<uni-forms-item label="卡号" name="careId" required>
<uv-input placeholder="请输入您的IC卡号" v-model="formData.careId" maxlength="20"></uv-input>
</uni-forms-item>
<uni-forms-item label="姓名" name="name" required>
<uv-input placeholder="请输入您的姓名" v-model="formData.name" maxlength="6"></uv-input>
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input placeholder="请输入您的手机号码" v-model="formData.phone" maxlength="11"></uv-input>
</uni-forms-item>
</uni-forms>
</uni-card>
<view class="card-desc web-text-secondary">
<view>温馨提示</view>
<view>1、请输入卡号和姓名及手机号码进行激活</view>
<view>2、如果忘记用户信息,请先联系场馆</view>
</view>
<uni-card title="卡片信息" :border="false" :is-shadow="false" :padding="'10px 6px'">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
<uni-forms-item label="卡号" name="cardNum" required>
<uv-input placeholder="请输入您的IC卡号" v-model="formData.cardNum" maxlength="20"></uv-input>
</uni-forms-item>
<uni-forms-item label="姓名" name="username" required>
<uv-input placeholder="请输入您的姓名" v-model="formData.username" maxlength="6"></uv-input>
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input placeholder="请输入您的手机号码" v-model="formData.phone" maxlength="11"></uv-input>
</uni-forms-item>
</uni-forms>
</uni-card>
<view class="btn-bar">
<uv-button
class="save-user-profile"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="立即激活"
@click="submit"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
<!-- EmergencyEdit弹窗 -->
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="添加联系人" :border="false" :is-shadow="false" :padding="0">
<uv-form labelPosition="left" :model="form" :rules="rules" ref="form">
<uv-form-item label="姓名" prop="userInfo.name" borderBottom>
<uv-input placeholder="请输入姓名" v-model="form.name" maxlength="11" :customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item>
<uv-form-item label="性别" prop="userInfo.sex" borderBottom @click="showSexSelect">
<uv-input placeholder="请输入手机号码" v-model="form.phone" maxlength="11" :customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item>
<uv-button
class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="保存"
@click="save"
></uv-button>
</uv-form>
</uni-card>
</uni-popup>
</view>
<view class="card-desc web-text-secondary">
<view>温馨提示</view>
<view>1、请输入卡号和姓名及手机号码进行激活</view>
<view>2、如果忘记用户信息,请先联系场馆</view>
</view>
<view class="btn-bar">
<uv-button
class="save-user-profile"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="立即激活"
@click="submit"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
<!-- EmergencyEdit弹窗 -->
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="添加联系人" :border="false" :is-shadow="false" :padding="0">
<uv-form labelPosition="left" :model="form" :rules="rules" ref="form">
<uv-form-item label="姓名" prop="userInfo.name" borderBottom>
<uv-input placeholder="请输入姓名" v-model="form.name" maxlength="11"
:customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item>
<uv-form-item label="性别" prop="userInfo.sex" borderBottom @click="showSexSelect">
<uv-input placeholder="请输入手机号码" v-model="form.phone" maxlength="11"
:customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item>
<uv-button
class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="保存"
@click="save"
></uv-button>
</uv-form>
</uni-card>
</uni-popup>
</view>
</template>
<script>
import { useUserStore } from '@/store/modules/user';
import * as Api from '@/api/booking/emergency';
import {useUserStore} from '@/store/modules/user';
import * as Api from '@/api/think/thinkCard';
import * as MpMenuApi from '@/api/cms/mp-menu/index';
import { getWxOpenId } from '@/api/passport/login';
import { openUrl } from '@/utils/common';
import {getWxOpenId} from '@/api/passport/login';
import {openUrl} from '@/utils/common';
import { useTenantStore } from '@/store/modules/tenant';
import { pad } from 'crypto-js';
import {useTenantStore} from '@/store/modules/tenant';
import {pad} from 'crypto-js';
import {bindCard} from "@/api/think/thinkCard";
const tenantStore = useTenantStore();
const userStore = useUserStore();
export default {
data() {
return {
list: [],
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
},
// 表单数据
formData: {},
fields: {},
logo: '',
bookingUser: {},
server: [],
order: []
};
},
onLoad() {
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;
}
data() {
return {
list: [],
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
},
// 表单数据
formData: {},
fields: {},
logo: '',
bookingUser: {},
server: [],
order: []
};
},
onLoad() {
this.reload();
},
methods: {
async reload(e) {
const app = this;
Api.pageThinkCard({}).then(res => {
console.log(res)
})
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
} else {
app.isLogin = false;
}
// 获取联系人列表
// Api.pageEmergency({
// userId: userInfo.userId
// }).then((res) => {
// app.list = res.list;
// });
},
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;
}
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
// Api.removeEmergency(item.emergencyId).then((res) => {
// uni.showToast({
// title: '操作成功',
// icon: 'none'
// });
// });
app.reload();
}
}
});
},
// 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
// const saveOrUpdate = this.formData.id ? Api.updateICCard : Api.addICCard
// saveOrUpdate(this.formData).then(message => {
// uni.showToast({
// title: '保存成功',
// icon: 'success'
// })
// this.$refs.addForm.close()
// this.reload()
// }).catch((err) => {
// console.log(err);
// })
// console.log('表单数据信息:', res);
}).catch(err => {
console.log('表单错误信息:', err);
})
},
}
// 获取联系人列表
// Api.pageEmergency({
// userId: userInfo.userId
// }).then((res) => {
// app.list = res.list;
// });
},
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;
}
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
// Api.removeEmergency(item.emergencyId).then((res) => {
// uni.showToast({
// title: '操作成功',
// icon: 'none'
// });
// });
app.reload();
}
}
});
},
// 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
Api.bindCard(this.formData).then(res => {
console.log(res)
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
});
}).catch(err => {
console.log('表单错误信息:', err);
})
},
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss">
.ic-card-body {
width: 692rpx;
margin: 20rpx auto;
height: 450rpx;
border-radius: 20rpx;
background: url('https://oss.wsdns.cn/20240528/a0a2eaa6073041bcb8ef182b87efe00a.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90');
background-size: 100%;
width: 692rpx;
margin: 20rpx auto;
height: 450rpx;
border-radius: 20rpx;
background: url('https://oss.wsdns.cn/20240528/a0a2eaa6073041bcb8ef182b87efe00a.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90');
background-size: 100%;
}
.card-desc{
padding: 20rpx 40rpx;
line-height: 1.4rem;
font-size:24rpx;
.card-desc {
padding: 20rpx 40rpx;
line-height: 1.4rem;
font-size: 24rpx;
}
.avatar {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
width: 700rpx;
margin: 40rpx auto;
}
.add-emergency {
width: 500rpx !important;
margin: 40rpx auto;
width: 500rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
</style>
+16 -15
View File
@@ -6,7 +6,7 @@
<view class="web-cell-content">
<view class="integral-bar web-cell web-cell-content">
<text class="web-text-placeholder">当前积分</text>
<text class="integral web-text-heading">{{ Math.floor(userInfo.users.integral) }}</text>
<text class="integral web-text-heading">{{ Math.floor(users.integral) }}</text>
</view>
<view class="sign-in-btn">
<uv-button class="btn" :disabled="todaySign"
@@ -30,8 +30,8 @@
import {
useUserStore
} from '@/store/modules/user';
import * as Api from '@/api/booking/integral';
import * as UserApi from '@/api/booking/users';
import * as Api from '@/api/think/thinkIntegral';
import * as UserApi from '@/api/think/thinkUsers';
import {
openUrl
} from '@/utils/common';
@@ -51,6 +51,7 @@
data() {
return {
userInfo: {},
users: {},
list: [],
statusBarHeight: 104,
isLogin: false,
@@ -84,21 +85,19 @@
// uni.showLoading({
// title: '请求中.'
// })
UserApi.getThinkUsers(uni.getStorageSync('uid')).then((data) => {
if (data) {
app.users = data;
}
});
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true
app.userInfo = userInfo
// 获取用户副表信息
UserApi.getByPhone({
phone: userInfo.phone
}).then((data) => {
if (data) {
app.userInfo.users = data;
app.userInfo.ouid = data.uid;
uni.setStorageSync('ouid',data.uid);
}
});
} else {
app.isLogin = false
}
@@ -138,8 +137,10 @@
const app = this
app.openLogin()
app.todaySign = true
Api.addIntegral({
id: app.userInfo.users.id
Api.addThinkIntegral({
id: uni.getStorageSync('uid'),
username: uni.getStorageSync('username'),
phone: uni.getStorageSync('phone')
}).then(res => {
// UserApi.updatePointsBySign()
// app.userInfo.points++
+13 -21
View File
@@ -17,17 +17,17 @@
</template>
</uv-cell>
</uv-form-item>
<uv-form-item prop="form.realName" borderBottom>
<uv-cell title="真实姓名" :value="form.realName">
<uv-form-item prop="form.truename" borderBottom>
<uv-cell title="真实姓名" :value="form.truename">
<template v-slot:value>
<uv-input placeholder="请输入真实姓名" v-model="form.realName" maxlength="11"></uv-input>
<uv-input placeholder="请输入真实姓名" v-model="form.truename" maxlength="11"></uv-input>
</template>
</uv-cell>
</uv-form-item>
<uv-form-item prop="form.idCard" borderBottom>
<uv-cell title="证件号码" :value="form.idCard">
<uv-cell title="证件号码" :value="form.idcard">
<template v-slot:value>
<uv-input placeholder="请输入证件号码" v-model="form.idCard"></uv-input>
<uv-input placeholder="请输入证件号码" v-model="form.idcard"></uv-input>
</template>
</uv-cell>
</uv-form-item>
@@ -67,7 +67,7 @@
import {
useUserStore
} from '@/store/modules/user';
import * as UserApi from '@/api/booking/users';
import * as UserApi from '@/api/think/thinkUsers';
import * as MpMenuApi from '@/api/cms/mp-menu/index';
import {
getWxOpenId
@@ -110,9 +110,7 @@
app.isLogin = true
app.form = userInfo
// 获取用户副表信息
UserApi.getByPhone({
phone: userInfo.phone
}).then(data => {
UserApi.getThinkUsers(uni.getStorageSync('uid')).then(data => {
if (data) {
app.form = Object.assign({}, app.form, data);
}
@@ -145,16 +143,16 @@
async chooseAvatar({detail}) {
const url = detail.avatarUrl
this.form.avatarUrl = await uploadOssByPath(url)
UserApi.updateUsers({
id: this.form.id,
avatarUrl: `${this.form.avatarUrl}`
})
await UserApi.updateThinkUsers({
id: this.form.id,
avatarUrl: `${this.form.avatarUrl}`
})
},
save() {
const app = this
const { form } = this
if(!uni.$uv.test.idCard(form.idCard)){
if(!uni.$uv.test.idCard(form.idcard)){
uni.showToast({
title: '请填写真实身份证号',
icon: 'none'
@@ -162,13 +160,7 @@
return false
}
UserApi.updateUsers({
phone: form.phone,
username: form.username,
realName: form.realName,
idCard: form.idCard,
id: form.id
}).then(res => {
UserApi.updateThinkUsers(this.form).then(res => {
uni.showToast({
title: '保存成功',
icon: 'success'