会员管理

This commit is contained in:
duan
2024-10-25 14:37:22 +08:00
parent 2cf3fe512b
commit baf3ebbc1b
4 changed files with 105 additions and 33 deletions

View File

@@ -24,7 +24,8 @@ let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
// 王伟本地测
// let baseUrl = '/ww'
// let baseUrl = 'http://192.168.1.15:8000'
// 巩
// let baseUrl = 'http://192.168.1.9:8000'
// 多少 ms 以内, 不提示loading
const loadingShowTime = 200
@@ -75,7 +76,6 @@ function commonsProcess(showLoading, httpReqCallback) {
} = httpData
// 避免混淆重新命名
let bodyData = data
console.log(statusCode,1111111111)
if (statusCode == 500) {
isShowErrorToast = true
return Promise.reject(bodyData) // 跳转到catch函数
@@ -125,12 +125,18 @@ function commonsProcess(showLoading, httpReqCallback) {
return Promise.resolve(bodyData)
}).catch(res => {
if(res.status==401||res.status==400){
if(res.status==401){
storageManage.token(null, true)
infoBox.showErrorToast('请登录').then(() => {
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
})
}
// if(res.status==400){
// storageManage.token(null, true)
// infoBox.showErrorToast('').then(() => {
// go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
// })
// }
if(res.status==500){
storageManage.token(null, true)
infoBox.showErrorToast('请登录').then(() => {

View File

@@ -213,7 +213,24 @@ export function midfiyAccount(data) {
}
})
}
// 新增会员
export function member(data) {
return request({
url: '/api/member',
method: 'post',
data: {
...data
}
})
}
// 修改会员
export function tbShopUser(data) {
return request({
url: `/api/tbShopUser`,
method: "put",
data
});
}
export function callTablecallRecord(params) {
return request({
url: '/callTable/callRecord',

View File

@@ -5,9 +5,9 @@
<uni-forms :model="userForm" :rules="rules" err-show-type="toast" validateTrigger="submit" ref="form"
:border="true" label-position="top" label-width="350">
<view class="block">
<uni-forms-item label="用户名" required name="name">
<uni-forms-item label="用户名" required name="nickName">
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="userForm.name" placeholder="填写用户名" />
v-model="userForm.nickName" placeholder="填写用户名" />
</uni-forms-item>
<uni-forms-item label="手机号" required name="phone">
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
@@ -20,36 +20,53 @@
</uni-forms-item> -->
<uni-forms-item label="生日" required name="birthday">
<uni-forms-item label="生日" required name="birthDay">
<view style="display: none;">
<uni-easyinput paddingNone :inputBorder="inputBorder" v-model="userForm.birthday"
<uni-easyinput paddingNone :inputBorder="inputBorder" v-model="userForm.birthDay"
placeholder="选择日期" />
</view>
<picker mode="date" :value="date" :start="startDate" :end="endDate"
@change="bindDateChange">
<view class="u-flex u-row-between u-p-b-10 lh40">
<view class="color-333">{{userForm.birthday||'选择日期'}}</view>
<view class="color-333">{{userForm.birthDay||'选择日期'}}</view>
<uni-icons type="right"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="用户余额" required name="balance">
<uni-forms-item label="性别" required name="birthDay">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'sex')">
<label class="radio u-m-r-60">
<radio value="1" :checked="userForm.sex == '1'" class="scale7" />
<text></text>
</label>
<label class="radio u-m-r-60">
<radio value="2" :checked="userForm.sex == '2'" class="scale7" />
<text></text>
</label>
</radio-group>
</uni-forms-item>
<!-- <uni-forms-item label="用户余额" required name="balance">
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="userForm.balance" placeholder="填写余额" />
</uni-forms-item>
<uni-forms-item label="用户积分" required name="integral">
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="userForm.integral" placeholder="填写积分" />
</uni-forms-item>
</uni-forms-item> -->
</view>
<view class="block border-top-0">
<!-- <view class="block border-top-0">
<uni-forms-item label="" required>
<view class="u-flex u-row-between lh40">
<view class="label-title">会员</view>
<view class="label-title">状态</view>
<my-switch v-model="userForm.isVip"></my-switch>
</view>
</uni-forms-item>
</view>
</view> -->
</uni-forms>
</view>
@@ -67,6 +84,13 @@
import infoBox from '@/commons/utils/infoBox.js';
import mySwitch from '@/components/my-components/my-switch.vue'
import myButton from '@/components/my-components/my-button.vue'
import {
member,
tbShopUser
} from '@/http/yskApi/requestAll.js';
import {
onLoad,
onReady
@@ -87,7 +111,7 @@
const bottom = ref(null)
//表单验证
const rules = {
name: {
nickName: {
rules: [{
required: true,
errorMessage: '请填写用户名'
@@ -140,20 +164,22 @@
function bindDateChange(e) {
console.log(e);
userForm.birthday = e.detail.value
userForm.birthDay = e.detail.value
}
function onFieldChange(e) {
console.log(e);
}
// 用户表单
const userForm = reactive({
name: '',
let userForm = reactive({
nickName: '',
phone: '',
birthday: '',
birthDay: '',
balance: '',
integral: '',
isVip: false,
level: 1,
sex: 1
})
@@ -173,23 +199,48 @@
onLoad(params => {
if (isEmpty(params)) {
option.type = params.type ? params.type : 'add'
if (params.item) {
let items = JSON.parse(params.item)
uni.setNavigationBarTitle({
title: '编辑用户'
})
items.phone = items.telephone
items.sex = items.sex == '男' ? 1 : 2
userForm = items
option.type = 'edit'
} else {
uni.setNavigationBarTitle({
title: '新增用户'
})
option.type = 'add'
}
console.log(option.type);
uni.setNavigationBarTitle({
title: option.type === 'add' ? '添加用户' : '编辑用户'
})
})
function sizeChange(e, name) {
userForm[name] = e.detail.value
}
function save() {
form.value.validate().then(res => {
console.log(res)
form.value.validate().then(async res => {
let obj = {
...userForm,
name: userForm.nickName,
telephone: userForm.phone,
birthday:userForm.birthDay,
status:1,
levelConsume:0,
shopId: uni.getStorageSync("shopId"),
}
if (res) {
if (option.type == 'add') {
const ele = await member(obj)
} else {
const ele = await tbShopUser(obj)
}
go.back()
}
})
}

View File

@@ -290,7 +290,6 @@
go.to('PAGES_USER_ADD')
}
let callTabletakeNumberEvent = async () => {
console.log(datas.form, '调试1')
let res = await midfiyAccount({
id: datas.activeUser.id,
...datas.form
@@ -334,9 +333,8 @@
} else if (i == 1) {
hasPermission('允许管理会员信息').then(ele => {
if (ele) {
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
consId: actionSheet.activeId,
item: JSON.stringify(actionSheet.active)
go.to('PAGES_USER_ADD', {
item: JSON.stringify(datas.activeUser)
})
}
})