会员管理
This commit is contained in:
@@ -24,7 +24,8 @@ let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
|||||||
// 王伟本地测
|
// 王伟本地测
|
||||||
// let baseUrl = '/ww'
|
// let baseUrl = '/ww'
|
||||||
// let baseUrl = 'http://192.168.1.15:8000'
|
// let baseUrl = 'http://192.168.1.15:8000'
|
||||||
|
// 巩
|
||||||
|
// let baseUrl = 'http://192.168.1.9:8000'
|
||||||
// 多少 ms 以内, 不提示loading
|
// 多少 ms 以内, 不提示loading
|
||||||
const loadingShowTime = 200
|
const loadingShowTime = 200
|
||||||
|
|
||||||
@@ -75,7 +76,6 @@ function commonsProcess(showLoading, httpReqCallback) {
|
|||||||
} = httpData
|
} = httpData
|
||||||
// 避免混淆重新命名
|
// 避免混淆重新命名
|
||||||
let bodyData = data
|
let bodyData = data
|
||||||
console.log(statusCode,1111111111)
|
|
||||||
if (statusCode == 500) {
|
if (statusCode == 500) {
|
||||||
isShowErrorToast = true
|
isShowErrorToast = true
|
||||||
return Promise.reject(bodyData) // 跳转到catch函数
|
return Promise.reject(bodyData) // 跳转到catch函数
|
||||||
@@ -125,12 +125,18 @@ function commonsProcess(showLoading, httpReqCallback) {
|
|||||||
return Promise.resolve(bodyData)
|
return Promise.resolve(bodyData)
|
||||||
|
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
if(res.status==401||res.status==400){
|
if(res.status==401){
|
||||||
storageManage.token(null, true)
|
storageManage.token(null, true)
|
||||||
infoBox.showErrorToast('请登录').then(() => {
|
infoBox.showErrorToast('请登录').then(() => {
|
||||||
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
|
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){
|
if(res.status==500){
|
||||||
storageManage.token(null, true)
|
storageManage.token(null, true)
|
||||||
infoBox.showErrorToast('请登录').then(() => {
|
infoBox.showErrorToast('请登录').then(() => {
|
||||||
|
|||||||
@@ -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) {
|
export function callTablecallRecord(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/callTable/callRecord',
|
url: '/callTable/callRecord',
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
<uni-forms :model="userForm" :rules="rules" err-show-type="toast" validateTrigger="submit" ref="form"
|
<uni-forms :model="userForm" :rules="rules" err-show-type="toast" validateTrigger="submit" ref="form"
|
||||||
:border="true" label-position="top" label-width="350">
|
:border="true" label-position="top" label-width="350">
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<uni-forms-item label="用户名" required name="name">
|
<uni-forms-item label="用户名" required name="nickName">
|
||||||
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
v-model="userForm.name" placeholder="填写用户名" />
|
v-model="userForm.nickName" placeholder="填写用户名" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="手机号" required name="phone">
|
<uni-forms-item label="手机号" required name="phone">
|
||||||
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
@@ -20,36 +20,53 @@
|
|||||||
|
|
||||||
</uni-forms-item> -->
|
</uni-forms-item> -->
|
||||||
|
|
||||||
<uni-forms-item label="生日" required name="birthday">
|
<uni-forms-item label="生日" required name="birthDay">
|
||||||
<view style="display: none;">
|
<view style="display: none;">
|
||||||
<uni-easyinput paddingNone :inputBorder="inputBorder" v-model="userForm.birthday"
|
<uni-easyinput paddingNone :inputBorder="inputBorder" v-model="userForm.birthDay"
|
||||||
placeholder="选择日期" />
|
placeholder="选择日期" />
|
||||||
</view>
|
</view>
|
||||||
<picker mode="date" :value="date" :start="startDate" :end="endDate"
|
<picker mode="date" :value="date" :start="startDate" :end="endDate"
|
||||||
@change="bindDateChange">
|
@change="bindDateChange">
|
||||||
<view class="u-flex u-row-between u-p-b-10 lh40">
|
<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>
|
<uni-icons type="right"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
</uni-forms-item>
|
</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"
|
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
v-model="userForm.balance" placeholder="填写余额" />
|
v-model="userForm.balance" placeholder="填写余额" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="用户积分" required name="integral">
|
<uni-forms-item label="用户积分" required name="integral">
|
||||||
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
v-model="userForm.integral" placeholder="填写积分" />
|
v-model="userForm.integral" placeholder="填写积分" />
|
||||||
</uni-forms-item>
|
</uni-forms-item> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="block border-top-0">
|
<!-- <view class="block border-top-0">
|
||||||
<uni-forms-item label="" required>
|
<uni-forms-item label="" required>
|
||||||
<view class="u-flex u-row-between lh40">
|
<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>
|
<my-switch v-model="userForm.isVip"></my-switch>
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
@@ -67,6 +84,13 @@
|
|||||||
import infoBox from '@/commons/utils/infoBox.js';
|
import infoBox from '@/commons/utils/infoBox.js';
|
||||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||||
import myButton from '@/components/my-components/my-button.vue'
|
import myButton from '@/components/my-components/my-button.vue'
|
||||||
|
import {
|
||||||
|
member,
|
||||||
|
tbShopUser
|
||||||
|
} from '@/http/yskApi/requestAll.js';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady
|
onReady
|
||||||
@@ -87,7 +111,7 @@
|
|||||||
const bottom = ref(null)
|
const bottom = ref(null)
|
||||||
//表单验证
|
//表单验证
|
||||||
const rules = {
|
const rules = {
|
||||||
name: {
|
nickName: {
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
errorMessage: '请填写用户名'
|
errorMessage: '请填写用户名'
|
||||||
@@ -140,20 +164,22 @@
|
|||||||
|
|
||||||
function bindDateChange(e) {
|
function bindDateChange(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
userForm.birthday = e.detail.value
|
userForm.birthDay = e.detail.value
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFieldChange(e) {
|
function onFieldChange(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
// 用户表单
|
// 用户表单
|
||||||
const userForm = reactive({
|
let userForm = reactive({
|
||||||
name: '',
|
nickName: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
birthday: '',
|
birthDay: '',
|
||||||
balance: '',
|
balance: '',
|
||||||
integral: '',
|
integral: '',
|
||||||
isVip: false,
|
isVip: false,
|
||||||
|
level: 1,
|
||||||
|
sex: 1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -173,23 +199,48 @@
|
|||||||
|
|
||||||
|
|
||||||
onLoad(params => {
|
onLoad(params => {
|
||||||
|
if (params.item) {
|
||||||
if (isEmpty(params)) {
|
let items = JSON.parse(params.item)
|
||||||
option.type = params.type ? params.type : 'add'
|
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() {
|
function save() {
|
||||||
form.value.validate().then(res => {
|
form.value.validate().then(async res => {
|
||||||
console.log(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()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,6 @@
|
|||||||
go.to('PAGES_USER_ADD')
|
go.to('PAGES_USER_ADD')
|
||||||
}
|
}
|
||||||
let callTabletakeNumberEvent = async () => {
|
let callTabletakeNumberEvent = async () => {
|
||||||
console.log(datas.form, '调试1')
|
|
||||||
let res = await midfiyAccount({
|
let res = await midfiyAccount({
|
||||||
id: datas.activeUser.id,
|
id: datas.activeUser.id,
|
||||||
...datas.form
|
...datas.form
|
||||||
@@ -334,9 +333,8 @@
|
|||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
hasPermission('允许管理会员信息').then(ele => {
|
hasPermission('允许管理会员信息').then(ele => {
|
||||||
if (ele) {
|
if (ele) {
|
||||||
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
go.to('PAGES_USER_ADD', {
|
||||||
consId: actionSheet.activeId,
|
item: JSON.stringify(datas.activeUser)
|
||||||
item: JSON.stringify(actionSheet.active)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user