Compare commits
12 Commits
68993a05de
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| 684014e183 | |||
| 6c08b3b878 | |||
| b8e8815cca | |||
| 2c5b47ad8b | |||
| f265c47617 | |||
| d40ded92b0 | |||
| 2fac00ceeb | |||
| f7b26cfc70 | |||
| 273986578f | |||
| c28509474d | |||
| e37cab4692 | |||
| 21c667312f |
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<view class="upload-file" @click="chooseImage">
|
||||
<view class="upload-file" @click="chooseImage" :style="returnStyle('box')">
|
||||
<slot v-if="$slots.default"></slot>
|
||||
<view class="icon" v-if="!modelValue">+</view>
|
||||
<image class="img" v-else :src="modelValue"></image>
|
||||
<image class="img" v-else :src="modelValue" :style="returnStyle('img')"></image>
|
||||
|
||||
<view class="close" @click.stop="() => {}" v-if="modelValue">
|
||||
<up-icon name="close-circle" color="#333" size="14" @click="clearImg"></up-icon>
|
||||
@@ -11,79 +11,152 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { uploadFile } from '@/http/api/index.js';
|
||||
import {
|
||||
uploadFile
|
||||
} from '@/http/api/index.js';
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
|
||||
const modelValue = defineModel({
|
||||
type: String,
|
||||
default: ''
|
||||
});
|
||||
|
||||
function chooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async function (res) {
|
||||
uni.showLoading({
|
||||
title: '上传中'
|
||||
});
|
||||
console.log(res);
|
||||
const fileRes = await uploadFile(res.tempFiles[0]);
|
||||
uni.hideLoading();
|
||||
if (fileRes) {
|
||||
modelValue.value = fileRes;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'none'
|
||||
});
|
||||
const props = defineProps({
|
||||
size: {
|
||||
default: ''
|
||||
},
|
||||
// 图片最大上传大小,单位M,默认undefined(不限制大小)
|
||||
maxSize: {
|
||||
type: [Number, String], // 支持数字(如2)或字符串(如"2")传参
|
||||
default: undefined,
|
||||
validator: (value) => {
|
||||
// 校验:传参必须是大于0的数字(转换后),否则视为不限制
|
||||
const numValue = Number(value);
|
||||
return value === undefined || (!isNaN(numValue) && numValue > 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
function clearImg() {
|
||||
modelValue.value = '';
|
||||
}
|
||||
function returnStyle(type) {
|
||||
let size = null
|
||||
if (!props.size) {
|
||||
return
|
||||
}
|
||||
if (Number(props.size) === NaN) {
|
||||
size = props.size
|
||||
} else {
|
||||
size = props.size + 'rpx'
|
||||
}
|
||||
return {
|
||||
width: size,
|
||||
height: size
|
||||
}
|
||||
}
|
||||
|
||||
const modelValue = defineModel({
|
||||
type: String,
|
||||
default: ''
|
||||
});
|
||||
|
||||
const emits = defineEmits('uploadSuccess')
|
||||
|
||||
// ------------- 新增2:工具函数:将M转换为字节(1M = 1024 * 1024 字节) -------------
|
||||
/**
|
||||
* 转换文件大小单位(M → 字节)
|
||||
* @returns {number} 最大允许的文件字节数,返回0表示不限制
|
||||
*/
|
||||
function getMaxFileSizeInBytes() {
|
||||
if (props.maxSize === undefined) return 0; // 未传参,返回0(不限制)
|
||||
|
||||
const maxSizeNum = Number(props.maxSize);
|
||||
// 无效数值,返回0(不限制)
|
||||
if (isNaN(maxSizeNum) || maxSizeNum <= 0) return 0;
|
||||
|
||||
// 转换公式:1M = 1024KB,1KB = 1024字节
|
||||
return maxSizeNum * 1024 * 1024;
|
||||
}
|
||||
|
||||
// ------------- 修改1:在上传前增加文件大小校验 -------------
|
||||
function chooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async function(res) {
|
||||
// 1. 获取文件信息(大小、临时路径等)
|
||||
const tempFile = res.tempFiles[0];
|
||||
const maxFileSize = getMaxFileSizeInBytes();
|
||||
|
||||
// 2. 校验文件大小(仅当maxFileSize>0时才校验)
|
||||
if (maxFileSize > 0 && tempFile.size > maxFileSize) {
|
||||
uni.showToast({
|
||||
title: `图片大小不能超过${props.maxSize}M`,
|
||||
icon: 'none'
|
||||
});
|
||||
return; // 校验失败,终止后续上传逻辑
|
||||
}
|
||||
|
||||
// 3. 校验通过,执行上传
|
||||
uni.showLoading({
|
||||
title: '上传中'
|
||||
});
|
||||
console.log(res);
|
||||
const fileRes = await uploadFile(tempFile);
|
||||
uni.hideLoading();
|
||||
|
||||
if (fileRes) {
|
||||
modelValue.value = fileRes;
|
||||
emits('uploadSuccess', fileRes)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearImg() {
|
||||
modelValue.value = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.upload-file {
|
||||
$size: 128rpx;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
position: relative;
|
||||
.close {
|
||||
position: absolute;
|
||||
right: -10rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
.img {
|
||||
.upload-file {
|
||||
$size: 128rpx;
|
||||
width: $size;
|
||||
height: $size;
|
||||
}
|
||||
.icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border: 4rpx solid #999;
|
||||
border-radius: 8rpx;
|
||||
font-weight: 700;
|
||||
color: #999;
|
||||
font-size: 32rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
position: relative;
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: -10rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $size;
|
||||
height: $size;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border: 4rpx solid #999;
|
||||
border-radius: 8rpx;
|
||||
font-weight: 700;
|
||||
color: #999;
|
||||
font-size: 32rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,29 +1,108 @@
|
||||
//当前环境 test,prod
|
||||
export const ENV = 'test'
|
||||
export const ENV_BASE_URL = {
|
||||
java: {
|
||||
prod: 'https://cashier.sxczgkj.com/',
|
||||
test: 'http://192.168.1.42/',
|
||||
h5ProdProxy: '/prodJavaApi/',
|
||||
h5TestProxy: '/testJavaApi/',
|
||||
},
|
||||
php: {
|
||||
prod: 'https://cashier.sxczgkj.com/',
|
||||
test: 'http://192.168.1.42:8787/',
|
||||
h5ProdProxy: '/prodPhpApi/api/',
|
||||
h5TestProxy: '/testPhpApi/api/',
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} env 环境,测试或者正式
|
||||
* @param {String} apiType 语言,java或者php
|
||||
*/
|
||||
export function returnBaseUrl(param) {
|
||||
let {
|
||||
env,
|
||||
apiType
|
||||
} = param
|
||||
if(!env){
|
||||
env=ENV
|
||||
}
|
||||
console.log('env', env);
|
||||
console.log('apiType', apiType);
|
||||
if (env === 'prod') {
|
||||
//正式环境
|
||||
// #ifdef H5
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.h5ProdProxy
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.h5ProdProxy
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.prod
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.prod
|
||||
}
|
||||
|
||||
} else {
|
||||
//测试环境
|
||||
// #ifdef H5
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.h5TestProxy
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.h5TestProxy
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.test
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.test
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const appConfig = {
|
||||
|
||||
|
||||
// 项目名称
|
||||
appName: '银收客',
|
||||
|
||||
|
||||
// token取值key
|
||||
tokenKey: 'iToken',
|
||||
// tokenKey: 'satoken',
|
||||
|
||||
|
||||
// 环境变量相关
|
||||
env: {},
|
||||
|
||||
|
||||
// wss: "wss://sockets.sxczgkj.com/wss", //测试环境
|
||||
wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境
|
||||
// 环境变量常量
|
||||
ENV_ENUM: {
|
||||
DEVELOPMENT: 'development', // 本地调试地址
|
||||
DEVELOPMENT: 'development', // 本地调试地址
|
||||
TEST: 'test', // 测试地址
|
||||
DEMO: 'demo', // 演示环境
|
||||
PRODUCTION: 'production' // 生产环境
|
||||
PRODUCTION: 'production' // 生产环境
|
||||
},
|
||||
|
||||
|
||||
returnBaseUrl: returnBaseUrl,
|
||||
storeEnvEnumKey: 'currentEnvEnum', // 本地存储的envkey的值
|
||||
|
||||
encryptKey: '1234567890123456' // http数据加解密的key
|
||||
|
||||
|
||||
encryptKey: '1234567890123456', // http数据加解密的key
|
||||
baseUrl: "",
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default appConfig;
|
||||
512
entryManager/add/add.vue
Normal file
512
entryManager/add/add.vue
Normal file
@@ -0,0 +1,512 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28 color-333">
|
||||
<steps v-model="step" />
|
||||
<view class="u-m-t-32">
|
||||
<basicInfo v-if="step==0" :data="form.merchantBaseInfo" :maxSize="maxSize"
|
||||
@update="update($event,'merchantBaseInfo')">
|
||||
</basicInfo>
|
||||
<legalPerpoleInfo v-if="step==1" :maxSize="maxSize" :data="form.legalPersonInfo"
|
||||
@update="update($event,'legalPersonInfo')">
|
||||
</legalPerpoleInfo>
|
||||
<businessLicenceInfo v-if="step==2" :maxSize="maxSize" :data="form.businessLicenceInfo"
|
||||
@update="update($event,'businessLicenceInfo')"></businessLicenceInfo>
|
||||
<storeInfo v-if="step==3" :maxSize="maxSize" :data="form.storeInfo" @update="update($event,'storeInfo')">
|
||||
</storeInfo>
|
||||
<settlementInfo v-if="step==4" :maxSize="maxSize" :data="form.settlementInfo"
|
||||
@update="update($event,'settlementInfo')">
|
||||
</settlementInfo>
|
||||
</view>
|
||||
<bottomBtnGroup @save="saveClick" @cancel="cancelClick" :cancelText="cancelText" :confirmText="confirmText">
|
||||
</bottomBtnGroup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import steps from './components/steps.vue'
|
||||
import basicInfo from './components/basic-info.vue'
|
||||
import legalPerpoleInfo from './components/legalPerpole-info.vue'
|
||||
import businessLicenceInfo from './components/business-licence-info.vue'
|
||||
import storeInfo from './components/store-info.vue'
|
||||
import settlementInfo from './components/settlement-info.vue'
|
||||
import bottomBtnGroup from './components/bottom-btn-group.vue'
|
||||
import dayjs from 'dayjs'
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
const form = reactive({
|
||||
"shopId": 0,
|
||||
"merchantCode": "",
|
||||
"merchantBaseInfo": {
|
||||
"userType": "0",
|
||||
"shortName": "",
|
||||
"mccCode": "",
|
||||
"alipayAccount": "",
|
||||
"contactPersonType": "LEGAL",
|
||||
"contactName": "",
|
||||
"certType": "0",
|
||||
"contactPersonId": "",
|
||||
"contactPersonIdStartDate": dayjs().valueOf(),
|
||||
"contactPersonIdEndDate": dayjs().add(10, 'year').valueOf(),
|
||||
"contactIdCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"contactIdCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"contactPhone": "",
|
||||
"contactAddr": "",
|
||||
"contactEmail": "",
|
||||
"companyChildType": "1"
|
||||
},
|
||||
"legalPersonInfo": {
|
||||
"legalPersonName": "",
|
||||
"legalPersonId": "",
|
||||
"legalIdPersonStartDate": dayjs().valueOf(),
|
||||
"legalPersonIdEndDate": dayjs().add(10, 'year').valueOf(),
|
||||
"legalPersonPhone": "",
|
||||
"legalPersonEmail": "",
|
||||
"legalGender": "",
|
||||
"legalAddress": "",
|
||||
"idCardHandPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
},
|
||||
"businessLicenceInfo": {
|
||||
"licenceName": "",
|
||||
"licenceNo": "",
|
||||
"licenceStartDate": dayjs().valueOf(),
|
||||
"licenceEndDate": dayjs().add(10, 'year').valueOf(),
|
||||
"registeredAddress": "",
|
||||
"licensePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
},
|
||||
"storeInfo": {
|
||||
"mercProvCode": "",
|
||||
"mercCityCode": "",
|
||||
"mercAreaCode": "",
|
||||
"mercProv": "",
|
||||
"mercCity": "",
|
||||
"mercArea": "",
|
||||
"businessAddress": "",
|
||||
"insidePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"doorPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"cashierDeskPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
},
|
||||
"settlementInfo": {
|
||||
"settlementType": "",
|
||||
"noLegalName": "",
|
||||
"noLegalId": "",
|
||||
"settlementCardType": "",
|
||||
"settlementCardNo": "",
|
||||
"settlementName": "",
|
||||
"bankMobile": "",
|
||||
"openAccProvinceId": "",
|
||||
"openAccCityId": "",
|
||||
"openAccAreaId": "",
|
||||
"openAccProvince": "",
|
||||
"openAccCity": "",
|
||||
"openAccArea": "",
|
||||
"bankName": "",
|
||||
"bankInstId": "",
|
||||
"bankType": "",
|
||||
"bankBranchName": "",
|
||||
"bankBranchCode": "",
|
||||
"bankCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"bankCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"openAccountLicencePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalHandSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
}
|
||||
})
|
||||
const maxSize = ref(2)
|
||||
const step = ref(1)
|
||||
|
||||
|
||||
import {
|
||||
addEntryManager
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
|
||||
const rules = {
|
||||
merchantBaseInfo: {
|
||||
userType: {
|
||||
required: true,
|
||||
errorMsg: '请选择商户类型',
|
||||
},
|
||||
shortName: {
|
||||
required: true,
|
||||
errorMsg: '请填写商户简称',
|
||||
},
|
||||
mccCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择行业类目',
|
||||
},
|
||||
alipayAccount: {
|
||||
required: true,
|
||||
errorMsg: '请填写支付宝账号',
|
||||
}
|
||||
},
|
||||
legalPersonInfo: {
|
||||
'idCardHandPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传身份证手持图片',
|
||||
},
|
||||
'idCardFrontPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传身份证正面图片',
|
||||
},
|
||||
'idCardBackPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传身份证反面图片',
|
||||
},
|
||||
legalPersonName: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人姓名',
|
||||
},
|
||||
legalPersonId: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人身份证号',
|
||||
},
|
||||
legalIdPersonStartDate: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人身份证开始日期',
|
||||
},
|
||||
legalPersonIdEndDate: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人身份证到期日期',
|
||||
},
|
||||
legalPersonPhone: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人电话',
|
||||
},
|
||||
legalPersonEmail: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人邮箱',
|
||||
},
|
||||
legalGender: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人性别',
|
||||
},
|
||||
legalAddress: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人地址',
|
||||
},
|
||||
|
||||
},
|
||||
storeInfo: {
|
||||
mercProvCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercCityCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercAreaCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercProv: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercCity: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercArea: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
businessAddress: {
|
||||
required: true,
|
||||
errorMsg: '请填写营业地址',
|
||||
},
|
||||
'insidePic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传经营场所内设照片',
|
||||
},
|
||||
'doorPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传门头照',
|
||||
},
|
||||
'cashierDeskPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传收银台照片',
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function isEmptyValue(val) {
|
||||
if (val === '' || val === undefined || val === null) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析属性路径,返回数组格式的路径片段
|
||||
* @param {string} str - 属性路径(如 'userType' 或 'idCardHandPic.url')
|
||||
* @returns {Array<string>} 属性路径片段数组(如 ['userType'] 或 ['idCardHandPic', 'url'])
|
||||
*/
|
||||
function returnKey(str) {
|
||||
// 无论是否包含'.',都返回数组,方便后续统一处理
|
||||
return str.includes('.') ? str.split('.') : [str];
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性路径数组,安全获取对象的嵌套属性值
|
||||
* @param {Object} obj - 目标对象(如 form.legalPersonInfo)
|
||||
* @param {Array<string>} keyPath - 属性路径数组(如 ['idCardHandPic', 'url'])
|
||||
* @returns {*} 嵌套属性的值(若路径不存在,返回 undefined)
|
||||
*/
|
||||
function getNestedValue(obj, keyPath) {
|
||||
// 边界处理:obj不是对象,直接返回undefined
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// 逐层遍历属性路径,获取最终值
|
||||
return keyPath.reduce((currentObj, key) => {
|
||||
// 中间层级不存在,直接返回undefined,避免报错
|
||||
if (currentObj === undefined || currentObj === null) {
|
||||
return undefined;
|
||||
}
|
||||
return currentObj[key];
|
||||
}, obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function verifyValue(val, ruleItem) {
|
||||
const isEmpty = isEmptyValue(val)
|
||||
let result = {
|
||||
ispas: true,
|
||||
errorMsg: ''
|
||||
}
|
||||
if (ruleItem.required) {
|
||||
|
||||
if (isEmpty) {
|
||||
result.ispas = false
|
||||
result.errorMsg = ruleItem.errorMsg
|
||||
return result
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function verifyData(data, rule) {
|
||||
// 边界处理:data不是对象,直接返回校验失败(若有必填规则)
|
||||
if (typeof data !== 'object' || data === null) {
|
||||
// 遍历规则,返回第一个必填项的错误信息
|
||||
for (let ruleKey in rule) {
|
||||
const ruleItem = rule[ruleKey];
|
||||
if (ruleItem.required) {
|
||||
return {
|
||||
ispas: false,
|
||||
errorMsg: ruleItem.errorMsg || '数据格式错误,无法校验'
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
ispas: true,
|
||||
errorMsg: ''
|
||||
};
|
||||
}
|
||||
|
||||
for (let ruleKey in rule) {
|
||||
const ruleItem = rule[ruleKey];
|
||||
// 1. 获取属性路径数组(如 ['idCardHandPic', 'url'])
|
||||
const keyPath = returnKey(ruleKey);
|
||||
// 2. 安全获取嵌套属性值(核心:支持深层级属性)
|
||||
const targetValue = getNestedValue(data, keyPath);
|
||||
// 3. 校验属性值
|
||||
const result = verifyValue(targetValue, ruleItem);
|
||||
|
||||
// 4. 校验失败,直接返回结果
|
||||
if (!result.ispas) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ispas: true,
|
||||
errorMsg: ''
|
||||
}
|
||||
}
|
||||
|
||||
function saveClick() {
|
||||
if (step.value == 0) {
|
||||
const {
|
||||
ispas,
|
||||
errorMsg
|
||||
} = verifyData(form.merchantBaseInfo, rules.merchantBaseInfo)
|
||||
if (!ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (step.value == 1) {
|
||||
const {
|
||||
ispas,
|
||||
errorMsg
|
||||
} = verifyData(form.legalPersonInfo, rules.legalPersonInfo)
|
||||
if (!ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (step.value == 2) {
|
||||
const {
|
||||
ispas,
|
||||
errorMsg
|
||||
} = verifyData(form.businessLicenceInfo, rules.businessLicenceInfo)
|
||||
if (!ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (step.value == 3) {
|
||||
const {
|
||||
ispas,
|
||||
errorMsg
|
||||
} = verifyData(form.storeInfo, rules.storeInfo)
|
||||
if (!ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (step.value != 4) {
|
||||
step.value++
|
||||
return
|
||||
}
|
||||
addEntryManager(form)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
function cancelClick() {
|
||||
step.value--;
|
||||
}
|
||||
|
||||
function update(value, key) {
|
||||
if (form.hasOwnProperty(key)) {
|
||||
form[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => form, (newval) => {
|
||||
uni.setStorageSync('entryManager_submit_data', form)
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
const cancelText = computed(() => {
|
||||
if (step.value == 0) {
|
||||
return '返回'
|
||||
}
|
||||
return '上一步'
|
||||
})
|
||||
const confirmText = computed(() => {
|
||||
if (step.value == 4) {
|
||||
return '提交'
|
||||
}
|
||||
return '下一步'
|
||||
})
|
||||
onMounted(() => {
|
||||
// const data=uni.getStorageSync('entryManager_submit_data')
|
||||
// if(data){
|
||||
// Object.assign(form,data)
|
||||
// }
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.min-page {
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
246
entryManager/add/components/bank-select.vue
Normal file
246
entryManager/add/components/bank-select.vue
Normal file
@@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择银行</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.bankName" @search="search" @change="bankNameChange" @custom="search"
|
||||
@clear="search"></up-search>
|
||||
</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="selid"
|
||||
class="scroll-view u-m-t-30" scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.id" @click="itemClick(item)"
|
||||
:id="'shop_'+item.id" :class="{active:selItem&&selItem.id==item.id}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.bankAlias}}</view>
|
||||
</view>
|
||||
|
||||
<up-loadmore :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
bankInfo
|
||||
} from '@/http/api/system/common.js';
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
const modelValue = defineModel();
|
||||
|
||||
const bankInstId = defineModel('bankInstId');
|
||||
|
||||
|
||||
|
||||
|
||||
const selid = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||
return findShop ? findShop.bankAlias : ''
|
||||
}
|
||||
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(bank) {
|
||||
selItem.value = bank;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
modelValue.value = selItem.value.bankAlias
|
||||
bankInstId.value = selItem.value.bankCode
|
||||
console.log('modelValue', modelValue.value);
|
||||
console.log('bankInstId', bankInstId.value);
|
||||
show.value = false;
|
||||
|
||||
}
|
||||
|
||||
function search() {
|
||||
isEnd.value = false
|
||||
query.page = 1
|
||||
init()
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
watch(() => modelValue.value, (newval) => {
|
||||
if (newval) {
|
||||
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||
if (findShop) {
|
||||
selid.value = 'shop_' + findShop.id
|
||||
selItem.value = findShop
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function openPopup() {
|
||||
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||
if (findShop) {
|
||||
selid.value = 'shop_' + findShop.id
|
||||
selItem.value = findShop
|
||||
}
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
// --------------- 核心新增:节流函数实现 ---------------
|
||||
/**
|
||||
* 节流函数:限制函数在指定时间内只触发一次
|
||||
* @param {Function} fn - 要节流的函数
|
||||
* @param {number} delay - 节流延迟时间(毫秒)
|
||||
* @returns {Function} 节流后的函数
|
||||
*/
|
||||
function throttle(fn, delay = 300) {
|
||||
let timer = null; // 定时器标识
|
||||
return function(...args) {
|
||||
// 如果已有定时器,直接返回(未到触发时间)
|
||||
if (timer) return;
|
||||
// 执行函数并设置新定时器
|
||||
fn.apply(this, args);
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
// --------------- 核心修改:创建节流后的search方法 ---------------
|
||||
// 300ms内只触发一次search,可根据需求调整delay值(如500ms)
|
||||
const throttledSearch = throttle(search, 300);
|
||||
|
||||
// --------------- 改造bankNameChange:调用节流后的搜索 ---------------
|
||||
function bankNameChange() {
|
||||
// 输入变化时,调用节流后的搜索方法
|
||||
throttledSearch();
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
bankName: ''
|
||||
})
|
||||
const isEnd = ref(false)
|
||||
|
||||
function scrolltolower() {
|
||||
if (isEnd.value) {
|
||||
return
|
||||
}
|
||||
query.page++
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
async function init() {
|
||||
const res = await bankInfo(query);
|
||||
isEnd.value = query.page >= res.totalPage * 1 ? true : false
|
||||
if (res) {
|
||||
if (query.page == 1) {
|
||||
list.value = res.records
|
||||
} else {
|
||||
list.value = list.value.concat(res.records)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
292
entryManager/add/components/bankBranchList.vue
Normal file
292
entryManager/add/components/bankBranchList.vue
Normal file
@@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择银行</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="keywords" @search="search" @change="search" @custom="search"
|
||||
@clear="search"></up-search>
|
||||
</view>
|
||||
<scroll-view scroll-with-animation :scroll-into-view="selid" class="scroll-view u-m-t-30"
|
||||
scroll-y="true" style="max-height :60vh;">
|
||||
<template v-if="list.length">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.bankCode"
|
||||
@click="itemClick(item)" :id="'shop_'+item.bankCode"
|
||||
:class="{active:selItem&&selItem.bankCode==item.bankCode}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.branchName}}</view>
|
||||
</view>
|
||||
<view class="u-p-20 u-flex u-row-center">
|
||||
<up-loadmore status="nomore"></up-loadmore>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="keywords">
|
||||
<up-empty text="未搜索到相关支行"></up-empty>
|
||||
</template>
|
||||
<up-empty v-else text="暂无支行"></up-empty>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
bankBranchList
|
||||
} from '@/http/api/order/entryManager.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
const modelValue = defineModel();
|
||||
const bankBranchName = defineModel('bankBranchName', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const selid = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.bankCode == modelValue.value)
|
||||
return findShop ? findShop.branchName : ''
|
||||
}
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(data) {
|
||||
selItem.value = data
|
||||
}
|
||||
|
||||
function returnbranchName(bankCode) {
|
||||
const item = list.value.find((v) => v.bankCode == bankCode);
|
||||
return item?.branchName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
modelValue.value = selItem.value.bankCode
|
||||
bankBranchName.value = selItem.value.branchName
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const keywords = ref('')
|
||||
|
||||
function search() {
|
||||
list.value = matchStr(allList, keywords.value)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模糊匹配对象数组中每个对象的全部属性,按匹配度由高到低排序返回,未匹配到的对象直接过滤(不返回)
|
||||
* @param {Array<Object>} arr - 待匹配的对象数组(必传,非数组返回空数组)
|
||||
* @param {string} str - 待匹配的目标字符串(空字符串返回原数组浅拷贝)
|
||||
* @returns {Array<Object>} 按匹配度降序排序后的对象数组(仅包含匹配项,不修改原数组)
|
||||
*/
|
||||
function matchStr(arr, str) {
|
||||
// ------------- 步骤1:严格边界处理,避免运行报错 -------------
|
||||
if (!Array.isArray(arr)) {
|
||||
console.warn('入参arr必须是对象数组');
|
||||
return [];
|
||||
}
|
||||
const targetStr = String(str || '').trim().toLowerCase();
|
||||
if (!targetStr) {
|
||||
return [...arr]; // 空字符串返回原数组浅拷贝(保持原有逻辑)
|
||||
}
|
||||
|
||||
// ------------- 步骤2:定义匹配度得分规则 -------------
|
||||
const getSinglePropScore = (propValue) => {
|
||||
const propStr = String(propValue).trim().toLowerCase();
|
||||
if (propStr === targetStr) return 3;
|
||||
if (propStr.startsWith(targetStr)) return 2;
|
||||
if (propStr.includes(targetStr)) return 1;
|
||||
return 0;
|
||||
};
|
||||
|
||||
// ------------- 步骤3:遍历数组,计算每个对象的总匹配度得分 -------------
|
||||
const arrWithScore = arr.map(item => {
|
||||
if (typeof item !== 'object' || item === null) {
|
||||
return {
|
||||
originItem: item,
|
||||
totalScore: 0
|
||||
};
|
||||
}
|
||||
|
||||
let totalScore = 0;
|
||||
Object.keys(item).forEach(propKey => {
|
||||
const propValue = item[propKey];
|
||||
totalScore += getSinglePropScore(propValue);
|
||||
});
|
||||
|
||||
return {
|
||||
originItem: item,
|
||||
totalScore: totalScore
|
||||
};
|
||||
});
|
||||
|
||||
// ------------- 步骤4:先过滤(仅保留得分>0的项),再排序,最后返回原对象格式 -------------
|
||||
return arrWithScore
|
||||
.filter(item => item.totalScore > 0) // 核心新增:过滤未匹配项(总得分=0的对象不保留)
|
||||
.sort((a, b) => b.totalScore - a.totalScore) // 仅对匹配项进行降序排序
|
||||
.map(item => item.originItem); // 剔除得分字段,返回原对象格式
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selid.value = 'shop_' + modelValue.value
|
||||
const findShop = list.value.find(v => v.bankCode == modelValue.value)
|
||||
selItem.value=findShop?findShop:null
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
// --------------- 核心新增:节流函数实现 ---------------
|
||||
/**
|
||||
* 节流函数:限制函数在指定时间内只触发一次
|
||||
* @param {Function} fn - 要节流的函数
|
||||
* @param {number} delay - 节流延迟时间(毫秒)
|
||||
* @returns {Function} 节流后的函数
|
||||
*/
|
||||
function throttle(fn, delay = 300) {
|
||||
let timer = null; // 定时器标识
|
||||
return function(...args) {
|
||||
// 如果已有定时器,直接返回(未到触发时间)
|
||||
if (timer) return;
|
||||
// 执行函数并设置新定时器
|
||||
fn.apply(this, args);
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
// --------------- 核心修改:创建节流后的search方法 ---------------
|
||||
// 300ms内只触发一次search,可根据需求调整delay值(如500ms)
|
||||
const throttledSearch = throttle(search, 300);
|
||||
|
||||
// --------------- 改造bankNameChange:调用节流后的搜索 ---------------
|
||||
function bankNameChange() {
|
||||
// 输入变化时,调用节流后的搜索方法
|
||||
throttledSearch();
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
query: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
province: '',
|
||||
city: '',
|
||||
instId: '',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => show.value, (newval) => {
|
||||
init()
|
||||
})
|
||||
|
||||
let allList = []
|
||||
async function init() {
|
||||
const res = await bankBranchList(props.query);
|
||||
list.value = res
|
||||
allList = res
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 40rpx 20rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
302
entryManager/add/components/basic-info.vue
Normal file
302
entryManager/add/components/basic-info.vue
Normal file
@@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">商户基础信息</view>
|
||||
<view class="container">
|
||||
<!-- <view class="form-item">
|
||||
<view class="font-bold u-m-b-16">店铺</view>
|
||||
<shopSelect></shopSelect>
|
||||
</view> -->
|
||||
<view class="form-item required">
|
||||
<view class="title">商户类型</view>
|
||||
<up-radio-group v-model="form.userType">
|
||||
<up-radio v-for="(value,key) in userTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">企业类型</view>
|
||||
<up-radio-group v-model="form.companyChildType">
|
||||
<up-radio v-for="(value,key) in companyChildTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">商户简称</view>
|
||||
<up-input placeholder="商户简称" :placeholder-class="placeholderClass" v-model="form.shortName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 行业类目</view>
|
||||
<mccCategory v-model="form.mccCode"></mccCategory>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 支付宝账号</view>
|
||||
<up-input placeholder="支付宝账号" :placeholder-class="placeholderClass"
|
||||
v-model="form.alipayAccount"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">联系人类型</view>
|
||||
<up-radio-group v-model="form.contactPersonType">
|
||||
<up-radio v-for="(value,key) in contactPersonTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<template v-if="form.contactPersonType=='SUPER'">
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人身份证正面</view>
|
||||
<my-upload-img v-model="form.contactIdCardFrontPic.url" :size="200"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','contactIdCardFrontPic')"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人身份证背面</view>
|
||||
<my-upload-img v-model="form.contactIdCardBackPic.url" :size="200"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','contactIdCardBackPic')"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<!-- <view class="form-item required">
|
||||
<view class="title">证件类型</view>
|
||||
<up-radio-group v-model="form.certType">
|
||||
<up-radio v-for="(value,key) in certTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view> -->
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人姓名</view>
|
||||
<up-input placeholder="联系人姓名" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactName"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人身份证号</view>
|
||||
<up-input placeholder="联系人身份证号" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactPersonId"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人身份证开始日期</view>
|
||||
<up-datetime-picker hasInput :minDate="minDate" :maxDate="maxDate" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.contactPersonIdStartDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人身份证到期日期</view>
|
||||
<view class="u-m-b-16">
|
||||
<up-radio-group v-model="contactPersonIdEndDateType">
|
||||
<up-radio :name="1" label="有结束日期"></up-radio>
|
||||
<up-radio :name="2" label="长期有效"></up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<template v-if="contactPersonIdEndDateType==1">
|
||||
<up-datetime-picker hasInput :minDate="endDataMinDate" :maxDate="maxDate" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.contactPersonIdEndDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人电话</view>
|
||||
<up-input placeholder="联系人电话" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactPhone"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人通讯地址</view>
|
||||
<up-input placeholder="联系人通讯地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactAddr"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 联系人邮箱
|
||||
</view>
|
||||
<up-input placeholder="联系人邮箱" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactEmail"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import mccCategory from '@/entryManager/components/mcc-category.vue'
|
||||
import {
|
||||
userTypes,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
const minDate = dayjs('1970-01-01 00:00:00').valueOf()
|
||||
const maxDate = dayjs('2099-12-31 23:59:59').valueOf()
|
||||
const endDataMinDate = computed(() => {
|
||||
if (!form.contactPersonIdStartDate) {
|
||||
return minDate
|
||||
}
|
||||
if (form.contactPersonIdStartDate) {
|
||||
return dayjs(form.contactPersonIdStartDate).add(10, 'year').valueOf()
|
||||
}
|
||||
return minDate
|
||||
})
|
||||
|
||||
const contactPersonIdEndDateType = ref(1)
|
||||
watch(() => contactPersonIdEndDateType.value, (newval) => {
|
||||
if (newval == 2) {
|
||||
form.contactPersonIdEndDate = maxDate
|
||||
} else {
|
||||
form.contactPersonIdEndDate = dayjs().valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
const data = res.subImages[0].kvInfo.data
|
||||
if (key == 'contactIdCardBackPic') {
|
||||
if (data.validPeriod) {
|
||||
const [start, end] = data.validPeriod.split('-')
|
||||
if (start) {
|
||||
form.contactPersonIdStartDate = dayjs(start).valueOf()
|
||||
}
|
||||
if (end) {
|
||||
if (end.includes('长期')) {
|
||||
contactPersonIdEndDateType.value = 2
|
||||
} else {
|
||||
form.contactPersonIdEndDate = dayjs(end).valueOf()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key == 'contactIdCardFrontPic') {
|
||||
form.contactName = data.name
|
||||
form.contactPersonId = data.idNumber
|
||||
form.contactAddr = data.address
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
const form = reactive({
|
||||
userType: '0',
|
||||
shortName: '',
|
||||
mccCode: '',
|
||||
alipayAccount: '',
|
||||
contactPersonType: 'LEGAL',
|
||||
contactName: '',
|
||||
certType: '0',
|
||||
contactPersonId: '',
|
||||
contactPersonIdStartDate: '',
|
||||
contactPersonIdEndDate: '',
|
||||
contactIdCardBackPic: {
|
||||
url: ''
|
||||
},
|
||||
contactIdCardFrontPic: {
|
||||
url: ''
|
||||
},
|
||||
contactPhone: '',
|
||||
contactAddr: '',
|
||||
contactEmail: '',
|
||||
companyChildType: '1',
|
||||
})
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
console.log('form', form);
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
81
entryManager/add/components/bottom-btn-group.vue
Normal file
81
entryManager/add/components/bottom-btn-group.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<view v-if="isShow">
|
||||
<view class="zhanwei" :class="[direction == 'column' ? 'zhanwei1' : '']"></view>
|
||||
|
||||
<view class="fixed-bottom u-flex gap-20" :class="[direction == 'column' ? 'u-flex-column' : '']">
|
||||
<view class="u-flex-1">
|
||||
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
|
||||
{{cancelText}}
|
||||
</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="save" shape="circle">
|
||||
{{confirmText}}
|
||||
</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed
|
||||
} from "vue";
|
||||
const emit = defineEmits(["save", "cancel"]);
|
||||
import {
|
||||
isMainShop
|
||||
} from "@/store/account.js";
|
||||
|
||||
const props = defineProps({
|
||||
isOpenPermission: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
cancelText:{
|
||||
type: String,
|
||||
default: "上一步",
|
||||
},
|
||||
confirmText:{
|
||||
type: String,
|
||||
default: "下一步",
|
||||
},
|
||||
//方向 row横向布局 column 纵向布局
|
||||
direction: {
|
||||
type: String,
|
||||
default: "row",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const isShow = computed(() => {
|
||||
if (props.isOpenPermission) {
|
||||
return isMainShop();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
function save() {
|
||||
emit("save");
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
emit("cancel");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.zhanwei {
|
||||
height: 180rpx;
|
||||
}
|
||||
|
||||
.zhanwei1 {
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.fixed-bottom {
|
||||
&.u-flex-column {
|
||||
align-items: stretch;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
207
entryManager/add/components/business-licence-info.vue
Normal file
207
entryManager/add/components/business-licence-info.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">营业执照信息</view>
|
||||
<view class="container">
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照</view>
|
||||
<my-upload-img v-model="form.licensePic.url" :size="200"
|
||||
@uploadSuccess="uploadSuccess($event,'BusinessLicense')"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照全称</view>
|
||||
<up-input placeholder="营业执照全称" :placeholder-class="placeholderClass"
|
||||
v-model="form.licenceName"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照号码</view>
|
||||
<up-input placeholder="营业执照号码" :placeholder-class="placeholderClass"
|
||||
v-model="form.licenceNo"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照开始日期</view>
|
||||
<up-datetime-picker hasInput :minDate="minDate" :maxDate="dayjs().valueOf()" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.licenceStartDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
<!-- <up-input placeholder="营业执照开始日期" :placeholder-class="placeholderClass"
|
||||
v-model="form.licenceStartDate"></up-input> -->
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照结束日期</view>
|
||||
<view class="u-m-b-16">
|
||||
<up-radio-group v-model="licenceEndDateType">
|
||||
<up-radio :name="1" label="有结束日期"></up-radio>
|
||||
<up-radio :name="2" label="长期有效"></up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<template v-if="licenceEndDateType==1">
|
||||
<up-datetime-picker hasInput :minDate="form.licenceStartDate||minDate" :maxDate="maxDate"
|
||||
format="YYYY-MM-DD" placeholder="请选择" v-model="form.licenceEndDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照注册地址</view>
|
||||
<up-input placeholder="营业执照注册地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.registeredAddress"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
const minDate = dayjs('1970-01-01 00:00:00').valueOf()
|
||||
const maxDate = dayjs('2099-12-31 23:59:59').valueOf()
|
||||
const licenceEndDateType = ref(1)
|
||||
import {
|
||||
reactive,
|
||||
watch,
|
||||
ref
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
const form = reactive({
|
||||
"licenceName": "",
|
||||
"licenceNo": "",
|
||||
"licenceStartDate": "",
|
||||
"licenceEndDate": "",
|
||||
"registeredAddress": "",
|
||||
"licensePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
import {
|
||||
includes
|
||||
} from 'lodash';
|
||||
|
||||
watch(() => licenceEndDateType.value, (newval) => {
|
||||
if (newval == 2) {
|
||||
form.licenceEndDate = maxDate
|
||||
} else {
|
||||
form.licenceEndDate = dayjs().add(10, 'year').valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
const data = res.subImages[0].kvInfo.data
|
||||
form.licenceName = data.companyName
|
||||
form.licenceNo = data.creditCode
|
||||
form.registeredAddress = data.businessAddress
|
||||
if (data.validFromDate) {
|
||||
form.licenceStartDate = dayjs(data.validFromDate).valueOf()
|
||||
}
|
||||
if (data.validToDate) {
|
||||
form.licenceEndDate = dayjs(data.validToDate).valueOf()
|
||||
}
|
||||
// console.log(dayjs(form.licenceEndDate).format('YYYY-MM-DD'));
|
||||
if (data.validPeriod.includes('长期')) {
|
||||
licenceEndDateType.value = 2;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
const isRequired = ref('required')
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
console.log('触发父数据更新')
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 9px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dadbde;
|
||||
}
|
||||
</style>
|
||||
283
entryManager/add/components/legalPerpole-info.vue
Normal file
283
entryManager/add/components/legalPerpole-info.vue
Normal file
@@ -0,0 +1,283 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">法人信息</view>
|
||||
<view class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 身份证正面</view>
|
||||
<my-upload-img v-model="form.idCardFrontPic.url" :size="200" :maxSize="maxSize"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','idCardFrontPic')"
|
||||
></my-upload-img>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 身份证反面</view>
|
||||
<my-upload-img v-model="form.idCardBackPic.url" :size="200" :maxSize="maxSize"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','idCardBackPic')"
|
||||
></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 身份证手持 图片</view>
|
||||
<my-upload-img v-model="form.idCardHandPic.url" :size="200" :maxSize="maxSize"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人姓名</view>
|
||||
<up-input placeholder="法人姓名" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title">法人性别</view>
|
||||
<up-radio-group v-model="form.legalGender">
|
||||
<up-radio v-for="(value,key) in sexs" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人身份证号</view>
|
||||
<up-input placeholder="法人身份证号" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonId"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人身份证开始日期</view>
|
||||
|
||||
<up-datetime-picker hasInput :minDate="minDate" :maxDate="dayjs().valueOf()" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.legalIdPersonStartDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人身份证到期日期</view>
|
||||
|
||||
<view class="u-m-b-16">
|
||||
<up-radio-group v-model="endDateType">
|
||||
<up-radio :name="1" label="有结束日期"></up-radio>
|
||||
<up-radio :name="2" label="长期有效"></up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<template v-if="endDateType==1">
|
||||
<up-datetime-picker hasInput :minDate="endDataMinDate"
|
||||
:maxDate="maxDate" format="YYYY-MM-DD" placeholder="请选择"
|
||||
v-model="form.legalPersonIdEndDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人电话</view>
|
||||
<up-input placeholder="法人电话" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonPhone"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">法人地址 </view>
|
||||
<up-input placeholder="法人地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalAddress"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">法人邮箱 </view>
|
||||
<up-input placeholder="法人邮箱" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonEmail"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
watch,computed ,
|
||||
ref
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
const form = reactive({
|
||||
"legalPersonName": "",
|
||||
"legalPersonId": "",
|
||||
"legalIdPersonStartDate":'',
|
||||
"legalPersonIdEndDate": '',
|
||||
"legalPersonPhone": "",
|
||||
"legalPersonEmail": "",
|
||||
"legalGender": "",
|
||||
"legalAddress": "",
|
||||
"idCardHandPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { includes } from 'lodash';
|
||||
const minDate = dayjs('1970-01-01 00:00:00').valueOf()
|
||||
const maxDate = dayjs('2099-12-31 23:59:59').valueOf()
|
||||
const endDataMinDate = computed(() => {
|
||||
if (!form.legalIdPersonStartDate) {
|
||||
return maxDate
|
||||
}
|
||||
if (form.legalIdPersonStartDate) {
|
||||
return dayjs(form.legalIdPersonStartDate).add(10, 'year').valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
const endDateType = ref(1)
|
||||
watch(() => endDateType.value, (newval) => {
|
||||
if (newval == 2) {
|
||||
form.legalPersonIdEndDate = maxDate
|
||||
} else {
|
||||
form.legalPersonIdEndDate = dayjs().valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
const data = res.subImages[0].kvInfo.data
|
||||
if (key == 'idCardBackPic') {
|
||||
if (data.validPeriod) {
|
||||
const [start, end] = data.validPeriod.split('-')
|
||||
if (start) {
|
||||
form.legalIdPersonStartDate = dayjs(start).valueOf()
|
||||
}
|
||||
if (end) {
|
||||
if (end.includes('长期')) {
|
||||
endDateType.value = 2
|
||||
} else {
|
||||
form.legalPersonIdEndDate = dayjs(end).valueOf()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key == 'idCardFrontPic') {
|
||||
form.legalPersonName = data.name
|
||||
form.legalPersonId = data.idNumber
|
||||
form.legalAddress = data.address
|
||||
if(data.sex.includes('男')){
|
||||
form.legalGender='0'
|
||||
}
|
||||
if(data.sex.includes('女')){
|
||||
form.legalGender='1'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
},
|
||||
maxSize:{
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
354
entryManager/add/components/settlement-info.vue
Normal file
354
entryManager/add/components/settlement-info.vue
Normal file
@@ -0,0 +1,354 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">结算信息</view>
|
||||
<view class="container">
|
||||
<view class="form-item ">
|
||||
<view class="title"> 结算类型</view>
|
||||
<up-radio-group v-model="form.settlementType">
|
||||
<up-radio v-for="(value,key) in settlementTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<template v-if="form.settlementType*1==0">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人手持结算授权书</view>
|
||||
<my-upload-img v-model="form.noLegalHandSettleAuthPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人结算授权书</view>
|
||||
<my-upload-img v-model="form.noLegalSettleAuthPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人身份证正面</view>
|
||||
<my-upload-img v-model="form.noLegalIdCardFrontPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人身份证反面</view>
|
||||
<my-upload-img v-model="form.noLegalIdCardBackPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人姓名
|
||||
</view>
|
||||
|
||||
<up-input placeholder="非法人姓名" :placeholder-class="placeholderClass"
|
||||
v-model="form.noLegalName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人身份证号码
|
||||
</view>
|
||||
|
||||
<up-input placeholder="非法人身份证号码" :placeholder-class="placeholderClass"
|
||||
v-model="form.noLegalId"></up-input>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 结算卡类型</view>
|
||||
<up-radio-group v-model="form.settlementCardType">
|
||||
<up-radio v-for="(value,key) in settlementCardTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 银行卡正面</view>
|
||||
<my-upload-img @uploadSuccess="uploadSuccess($event,'BankCard','bankCardFrontPic')"
|
||||
v-model="form.bankCardFrontPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="{required:form.settlementCardType==11}">
|
||||
<view class="title"> 银行卡反面</view>
|
||||
<my-upload-img v-model="form.bankCardBackPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 地区</view>
|
||||
<view class="input-box u-flex u-row-between u-col-center" @click="showCitySelect=true">
|
||||
<text class="color-999" v-if="!pro_city_area">请选择</text>
|
||||
<text class="color-333" v-else>{{pro_city_area}}</text>
|
||||
<up-icon name="arrow-down"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 银行</view>
|
||||
<bankSelect v-model="form.bankName" v-model:bankInstId="form.bankInstId"></bankSelect>
|
||||
</view>
|
||||
<view class="form-item " v-if="pro_city_area&&form.bankName">
|
||||
<view class="title"> 支行</view>
|
||||
<bankBranchList :query="bankBranchListQuery" v-model:bankBranchName="form.bankBranchName"
|
||||
v-model:bankBranchCode="form.bankBranchCode"></bankBranchList>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 结算账户卡号</view>
|
||||
<up-input placeholder="结算账户卡号" :placeholder-class="placeholderClass"
|
||||
v-model="form.settlementCardNo"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 结算账户户名</view>
|
||||
<up-input placeholder="结算账户户名" :placeholder-class="placeholderClass"
|
||||
v-model="form.settlementName"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 结算银行预留手机号</view>
|
||||
<up-input placeholder="结算银行预留手机号" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankMobile"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 开户行行别名称</view>
|
||||
<up-input placeholder="开户行行别名称" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankName"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 开户行缩写</view>
|
||||
<up-input placeholder="开户行缩写" :placeholder-class="placeholderClass"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 开户行编号
|
||||
</view>
|
||||
<up-input placeholder="开户行编号" :placeholder-class="placeholderClass" v-model="form.bankType"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 支行开户行行别名称
|
||||
|
||||
</view>
|
||||
<up-input placeholder="支行开户行行别名称" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankBranchName"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 支行开户行编号
|
||||
|
||||
</view>
|
||||
<up-input placeholder="支行开户行编号" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankBranchCode"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 开户许可证</view>
|
||||
<my-upload-img v-model="form.openAccountLicencePic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<citySelect v-model="showCitySelect" @city-change="cityChange"></citySelect>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
watch,
|
||||
ref
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import citySelect from '../../components/u-city-select.vue'
|
||||
import bankSelect from './bank-select.vue'
|
||||
import bankBranchList from './bankBranchList.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
settlementTypes,
|
||||
settlementCardTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
const showCitySelect = ref(false)
|
||||
const showBankSelect = ref(true)
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
form.bankName = res.subImages[0].kvInfo.data.bankName
|
||||
form.settlementCardNo = res.subImages[0].kvInfo.data.cardNumber
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function basicSelectChange(e) {
|
||||
|
||||
}
|
||||
|
||||
function cityChange(e) {
|
||||
console.log('cityChange', e);
|
||||
form.openAccProvince = e.province.regionName;
|
||||
form.openAccCity = e.city.regionName;
|
||||
form.openAccArea = e.area.regionName;
|
||||
|
||||
form.openAccProvinceId = e.province.regionId;
|
||||
form.openAccCityId = e.city.regionId;
|
||||
form.openAccAreaId = e.area.regionId;
|
||||
console.log('form', form);
|
||||
}
|
||||
|
||||
const pro_city_area = computed(() => {
|
||||
if (form.openAccProvince && form.openAccCity && form.openAccArea) {
|
||||
const text = form.openAccProvince + '-' + form.openAccCity + '-' + form.openAccArea
|
||||
console.log('text', text);
|
||||
return text
|
||||
}
|
||||
return ''
|
||||
})
|
||||
const form = reactive({
|
||||
"settlementType": "0",
|
||||
"noLegalName": "",
|
||||
"noLegalId": "",
|
||||
"settlementCardType": "11",
|
||||
"settlementCardNo": "",
|
||||
"settlementName": "",
|
||||
"bankMobile": "",
|
||||
"openAccProvinceId": "",
|
||||
"openAccCityId": "",
|
||||
"openAccAreaId": "",
|
||||
"openAccProvince": "",
|
||||
"openAccCity": "",
|
||||
"openAccArea": "",
|
||||
"bankName": "",
|
||||
"bankInstId": "",
|
||||
"bankType": "",
|
||||
"bankBranchName": "",
|
||||
"bankBranchCode": "",
|
||||
"bankCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"bankCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"openAccountLicencePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalHandSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
const isRequired = ref('required')
|
||||
const bankBranchListQuery = computed(() => {
|
||||
return {
|
||||
province: form.openAccProvince,
|
||||
city: form.openAccCity,
|
||||
instId: form.bankInstId,
|
||||
}
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
console.log('watch 变', newval);
|
||||
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
console.log(form);
|
||||
}, {
|
||||
deep: true,immediate:true
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 10px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dadbde;
|
||||
}
|
||||
</style>
|
||||
165
entryManager/add/components/shop-select.vue
Normal file
165
entryManager/add/components/shop-select.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择门店</view>
|
||||
<scroll-view scroll-with-animation :scroll-into-view="selShopId" class="scroll-view u-m-t-30"
|
||||
scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.shopId" @click="itemClick(item)"
|
||||
:id="'shop_'+item.shopId" :class="{active:modelValue==item.shopId}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.shopName}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
adminShopList
|
||||
} from '@/http/api/shop.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
let modelValue = defineModel('modelValue', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const selShopId = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.shopId == modelValue.value)
|
||||
return findShop ? findShop.shopName : ''
|
||||
}
|
||||
|
||||
function itemClick(shop) {
|
||||
modelValue.value = shop.shopId
|
||||
}
|
||||
|
||||
function returnShopName(shopId) {
|
||||
const item = list.value.find((v) => v.shopId == shopId);
|
||||
return item?.shopName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selShopId.value = 'shop_' + modelValue.value
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
async function init() {
|
||||
const res = await adminShopList({
|
||||
page: 1,
|
||||
size: 99999
|
||||
});
|
||||
if (res) {
|
||||
list.value = res.records.map((item) => ({
|
||||
shopId: item.id,
|
||||
shopName: item.shopName,
|
||||
}));
|
||||
}
|
||||
}
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
180
entryManager/add/components/steps.vue
Normal file
180
entryManager/add/components/steps.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<scroll-view scroll-x="true" scroll-with-animation :scroll-left="scrollLeft" class="steps-scroll-container"
|
||||
ref="scrollViewRef">
|
||||
<view class="steps-content" ref="contentRef">
|
||||
<view v-for="(item,index) in list" class="step-item" :key="index" :data-index="index" ref="stepItemRefs">
|
||||
<view class="step-inner">
|
||||
<view class="index" :class="{active:index<=cur}">
|
||||
<text>{{index+1}}</text>
|
||||
</view>
|
||||
<view class="step-text color-999" :class="{'color-main':index<=cur}" @click="handleClick(index)">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="step-arrow" v-if="index!=list.length-1">
|
||||
<up-icon name="arrow-rightward" size="16" :color="isActive(index)?'#318AFE':'#999'"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
nextTick,
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
|
||||
const cur = defineModel({
|
||||
default:0
|
||||
})
|
||||
const scrollLeft = ref(0)
|
||||
const scrollViewRef = ref(null)
|
||||
const contentRef = ref(null) // 内容容器ref
|
||||
const stepItemRefs = ref([]) // 步骤项ref数组
|
||||
const instance = getCurrentInstance()
|
||||
|
||||
function isActive(index) {
|
||||
return cur.value === index
|
||||
}
|
||||
|
||||
// 核心:精准居中计算(基于元素相对于内容容器的偏移)
|
||||
const calcScrollCenter = (index) => {
|
||||
nextTick(async () => {
|
||||
try {
|
||||
const query = uni.createSelectorQuery().in(instance)
|
||||
|
||||
// 1. 获取滚动容器宽度
|
||||
const [scrollViewRect] = await new Promise(resolve => {
|
||||
query.select('.steps-scroll-container').boundingClientRect(rect => resolve([
|
||||
rect
|
||||
])).exec()
|
||||
})
|
||||
const scrollViewWidth = scrollViewRect?.width || 0
|
||||
|
||||
// 2. 获取当前步骤项的布局信息
|
||||
const [itemRect] = await new Promise(resolve => {
|
||||
query.select(`.step-item[data-index="${index}"]`).boundingClientRect(rect =>
|
||||
resolve([rect])).exec()
|
||||
})
|
||||
|
||||
// 3. 获取内容容器的布局信息
|
||||
const [contentRect] = await new Promise(resolve => {
|
||||
query.select('.steps-content').boundingClientRect(rect => resolve([rect]))
|
||||
.exec()
|
||||
})
|
||||
|
||||
if (!itemRect || !contentRect) return
|
||||
|
||||
// 关键修正:元素相对于内容容器的左偏移(而非视口)
|
||||
const itemOffsetLeft = itemRect.left - contentRect.left
|
||||
// 居中公式:滚动距离 = 元素偏移 - (容器宽度/2) + (元素宽度/2)
|
||||
let targetScrollLeft = itemOffsetLeft - (scrollViewWidth / 2) + (itemRect.width / 2)
|
||||
|
||||
// 4. 计算最大可滚动距离(边界限制)
|
||||
const maxScrollLeft = Math.max(0, contentRect.width - scrollViewWidth)
|
||||
// 限制滚动范围,避免超出边界
|
||||
targetScrollLeft = Math.max(0, Math.min(targetScrollLeft, maxScrollLeft))
|
||||
|
||||
// 5. 设置滚动距离(强制整数,避免小数导致的偏移)
|
||||
scrollLeft.value = Math.round(targetScrollLeft)
|
||||
} catch (e) {
|
||||
console.error('计算居中失败:', e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 点击事件
|
||||
const handleClick = (index) => {
|
||||
if (cur.value === index) return
|
||||
cur.value = index
|
||||
calcScrollCenter(index)
|
||||
}
|
||||
|
||||
// 初始化居中
|
||||
nextTick(() => {
|
||||
calcScrollCenter(cur.value)
|
||||
})
|
||||
|
||||
// 步骤列表
|
||||
const list = ref(['基础信息', '法人信息', '营业执照信息', '门店信息', '结算信息'])
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 滚动容器:固定宽度,隐藏滚动条
|
||||
.steps-scroll-container {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
overflow-x: auto;
|
||||
|
||||
// 隐藏滚动条(三端兼容)
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
// 内容容器:inline-flex,宽度自适应
|
||||
.steps-content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
|
||||
// 单个步骤项:统一间距和布局
|
||||
.step-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0 10rpx; // 统一间距
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
// 步骤内部布局
|
||||
.step-inner {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// 数字索引
|
||||
.index {
|
||||
border: 1px solid #999;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
margin-right: 10rpx;
|
||||
color: #999;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
}
|
||||
|
||||
// 步骤文字
|
||||
.step-text {
|
||||
white-space: nowrap;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
// 箭头容器
|
||||
.step-arrow {
|
||||
padding: 0 10rpx;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
// 样式补充
|
||||
.color-main {
|
||||
color: $my-main-color !important;
|
||||
}
|
||||
|
||||
.color-999 {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
178
entryManager/add/components/store-info.vue
Normal file
178
entryManager/add/components/store-info.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">门店信息</view>
|
||||
<view class="container">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 归属地</view>
|
||||
<view class="input-box u-flex u-row-between u-col-center" @click="showCitySelect=true">
|
||||
<text class="color-999" v-if="!pro_city_area">请选择</text>
|
||||
<text class="color-333" v-else>{{pro_city_area}}</text>
|
||||
<up-icon name="arrow-down"></up-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 营业地址</view>
|
||||
|
||||
<up-input placeholder="营业地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.businessAddress"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 经营场所内设照片</view>
|
||||
<my-upload-img v-model="form.insidePic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 门头照</view>
|
||||
<my-upload-img v-model="form.doorPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 收银台照片</view>
|
||||
<my-upload-img v-model="form.cashierDeskPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<citySelect v-model="showCitySelect" @city-change="cityChange"></citySelect>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,watch
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import citySelect from '../../components/u-city-select.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
const showCitySelect = ref(false)
|
||||
|
||||
function cityChange(e) {
|
||||
console.log('cityChange', e);
|
||||
form.mercProv = e.province.regionName;
|
||||
form.mercCity = e.city.regionName;
|
||||
form.mercArea = e.area.regionName;
|
||||
|
||||
form.mercProvCode = e.province.regionId;
|
||||
form.mercCityCode = e.city.regionId;
|
||||
form.mercAreaCode = e.area.regionId;
|
||||
console.log('form', form);
|
||||
}
|
||||
|
||||
const pro_city_area = computed(() => {
|
||||
if (form.mercProv && form.mercCity && form.mercArea) {
|
||||
const text = form.mercProv + '-' + form.mercCity + '-' + form.mercArea
|
||||
console.log('text', text);
|
||||
return text
|
||||
}
|
||||
return ''
|
||||
})
|
||||
const form = reactive({
|
||||
"mercProvCode": "",
|
||||
"mercCityCode": "",
|
||||
"mercAreaCode": "",
|
||||
"mercProv": "",
|
||||
"mercCity": "",
|
||||
"mercArea": "",
|
||||
"businessAddress": "",
|
||||
"insidePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"doorPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"cashierDeskPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
const isRequired = ref('required')
|
||||
|
||||
|
||||
|
||||
const props=defineProps({
|
||||
data:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(()=>props.data,(newval)=>{
|
||||
for(let key in form){
|
||||
if(props.data.hasOwnProperty(key)){
|
||||
form[key]=props.data[key]
|
||||
}
|
||||
}
|
||||
},{
|
||||
deep:true,immediate:true
|
||||
})
|
||||
|
||||
const emits=defineEmits(['update'])
|
||||
watch(()=>form,(newval)=>{
|
||||
emits('update',newval)
|
||||
},{
|
||||
deep:true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 10px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dadbde;
|
||||
}
|
||||
</style>
|
||||
1
entryManager/common/all.js
Normal file
1
entryManager/common/all.js
Normal file
File diff suppressed because one or more lines are too long
1
entryManager/common/area.js
Normal file
1
entryManager/common/area.js
Normal file
File diff suppressed because one or more lines are too long
1
entryManager/common/city.js
Normal file
1
entryManager/common/city.js
Normal file
File diff suppressed because one or more lines are too long
1087
entryManager/common/classify.data.js
Normal file
1087
entryManager/common/classify.data.js
Normal file
File diff suppressed because it is too large
Load Diff
1
entryManager/common/province.js
Normal file
1
entryManager/common/province.js
Normal file
@@ -0,0 +1 @@
|
||||
var provinceData=[{"label":"北京市","value":"11"},{"label":"天津市","value":"12"},{"label":"河北省","value":"13"},{"label":"山西省","value":"14"},{"label":"内蒙古自治区","value":"15"},{"label":"辽宁省","value":"21"},{"label":"吉林省","value":"22"},{"label":"黑龙江省","value":"23"},{"label":"上海市","value":"31"},{"label":"江苏省","value":"32"},{"label":"浙江省","value":"33"},{"label":"安徽省","value":"34"},{"label":"福建省","value":"35"},{"label":"江西省","value":"36"},{"label":"山东省","value":"37"},{"label":"河南省","value":"41"},{"label":"湖北省","value":"42"},{"label":"湖南省","value":"43"},{"label":"广东省","value":"44"},{"label":"广西壮族自治区","value":"45"},{"label":"海南省","value":"46"},{"label":"重庆市","value":"50"},{"label":"四川省","value":"51"},{"label":"贵州省","value":"52"},{"label":"云南省","value":"53"},{"label":"西藏自治区","value":"54"},{"label":"陕西省","value":"61"},{"label":"甘肃省","value":"62"},{"label":"青海省","value":"63"},{"label":"宁夏回族自治区","value":"64"},{"label":"新疆维吾尔自治区","value":"65"},{"label":"台湾","value":"66"},{"label":"香港","value":"67"},{"label":"澳门","value":"68"}];export default provinceData;
|
||||
302
entryManager/components/mcc-category.vue
Normal file
302
entryManager/components/mcc-category.vue
Normal file
@@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="selArr[0]===null||selArr[1]===null">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择行业类目</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.bankName" @search="search" @change="bankNameChange" @custom="search"
|
||||
@clear="search"></up-search>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-30 gap-20 u-col-top">
|
||||
<view class="u-flex-1">
|
||||
<view class="u-p-b-24 font-bold text-center">一级类目</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="oneSelId"
|
||||
class="scroll-view " scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="(item,index) in list" :key="item.id"
|
||||
@click="oneCategoryClick(index)" :id="'cateOne_'+index"
|
||||
:class="{active:selArr[0]===index}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.firstCategory}}</view>
|
||||
</view>
|
||||
<up-empty v-if="list.length==0" text="暂无相关分类"></up-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<view class="u-p-b-24 font-bold text-center">二级类目</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="twoSelId"
|
||||
class="scroll-view " scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="(item,index) in sendList" :key="item.id"
|
||||
@click="selArr[1]=index" :id="'cateTwo_'+index" :class="{active:selArr[1]==index}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.secondCategory}}</view>
|
||||
</view>
|
||||
<up-empty v-if="list.length==0" text="暂无相关分类"></up-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
mccCategory
|
||||
} from '@/http/api/system/common.js';
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
const modelValue = defineModel();
|
||||
|
||||
|
||||
|
||||
|
||||
const oneSelId = ref('')
|
||||
const twoSelId = ref('')
|
||||
|
||||
const allCategoryArr = computed(() => {
|
||||
return list.value.reduce((prve, cur) => {
|
||||
prve.push(...cur.child)
|
||||
return prve
|
||||
}, [])
|
||||
})
|
||||
|
||||
function returnLabel() {
|
||||
const [index1, index2] = selArr.value
|
||||
console.log('selArr', selArr.value);
|
||||
if (index1 !== null && index2 !== null) {
|
||||
return list.value[index1].firstCategory + '/' + list.value[index1].child[index2].secondCategory
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function oneCategoryClick(index) {
|
||||
selArr.value[0] = index
|
||||
selArr.value[1] = null
|
||||
}
|
||||
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(bank) {
|
||||
selItem.value = bank;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if (selArr.value[0] === null || selArr.value[1] === null) {
|
||||
return uni.showToast({
|
||||
title: '请选择行业类目',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
const [oneIndex, twoIndex] = selArr.value
|
||||
const item = list.value[oneIndex].child[twoIndex]
|
||||
modelValue.value = item.firstCategoryCode + '_' + item.secondCategoryCode
|
||||
show.value = false;
|
||||
|
||||
}
|
||||
|
||||
function search() {
|
||||
init()
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
|
||||
function openPopup() {
|
||||
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
// --------------- 核心新增:节流函数实现 ---------------
|
||||
/**
|
||||
* 节流函数:限制函数在指定时间内只触发一次
|
||||
* @param {Function} fn - 要节流的函数
|
||||
* @param {number} delay - 节流延迟时间(毫秒)
|
||||
* @returns {Function} 节流后的函数
|
||||
*/
|
||||
function throttle(fn, delay = 300) {
|
||||
let timer = null; // 定时器标识
|
||||
return function(...args) {
|
||||
// 如果已有定时器,直接返回(未到触发时间)
|
||||
if (timer) return;
|
||||
// 执行函数并设置新定时器
|
||||
fn.apply(this, args);
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
// --------------- 核心修改:创建节流后的search方法 ---------------
|
||||
// 300ms内只触发一次search,可根据需求调整delay值(如500ms)
|
||||
const throttledSearch = throttle(search, 300);
|
||||
|
||||
// --------------- 改造bankNameChange:调用节流后的搜索 ---------------
|
||||
function bankNameChange() {
|
||||
// 输入变化时,调用节流后的搜索方法
|
||||
throttledSearch();
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
bankName: ''
|
||||
})
|
||||
const isEnd = ref(false)
|
||||
|
||||
function scrolltolower() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function init() {
|
||||
const res = await mccCategory(query);
|
||||
if (res) {
|
||||
list.value = res.map(v => {
|
||||
return {
|
||||
...v,
|
||||
firstCategoryCode: v.child[0].firstCategoryCode
|
||||
}
|
||||
})
|
||||
startWatch()
|
||||
}
|
||||
}
|
||||
|
||||
const selArr = ref([null, null])
|
||||
const sendList = computed(() => {
|
||||
if (selArr.value[0] !== null) {
|
||||
return list.value[selArr.value[0]].child
|
||||
}
|
||||
})
|
||||
|
||||
function startWatch() {
|
||||
watch(() => modelValue.value, (newval) => {
|
||||
if (newval) {
|
||||
const arr = modelValue.value.split('_')
|
||||
const [oneCode, twoCode] = arr
|
||||
console.log('oneCode',oneCode);
|
||||
console.log('twoCode',twoCode);
|
||||
const oneIndex = list.value.findIndex(v => v.firstCategoryCode == oneCode)
|
||||
if (oneIndex != -1) {
|
||||
selArr.value[0] = oneIndex
|
||||
oneSelId.value = 'cateOne_' + oneIndex
|
||||
const twoIndex = list.value[oneIndex].child.findIndex(v => v.secondCategoryCode==twoCode)
|
||||
if (twoIndex != -1) {
|
||||
selArr.value[1] = twoIndex
|
||||
twoSelId.value = 'cateTwo_' + twoIndex
|
||||
}
|
||||
}
|
||||
console.log('watch selArr',selArr.value);
|
||||
} else {
|
||||
selArr.value = [null, null]
|
||||
}
|
||||
}, {
|
||||
immediate: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
257
entryManager/components/u-city-select.vue
Normal file
257
entryManager/components/u-city-select.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<up-popup :show="modelValue" mode="bottom" :popup="false"
|
||||
:mask="true" :closeable="true" :safe-area-inset-bottom="true"
|
||||
close-icon-color="#ffffff" :z-index="uZIndex"
|
||||
:maskCloseAble="maskCloseAble" @close="close">
|
||||
<up-tabs v-if="modelValue" :list="genTabsList"
|
||||
:scrollable="true" :current="tabsIndex" @change="tabsChange" ref="tabs"></up-tabs>
|
||||
<view class="area-box">
|
||||
<view class="u-flex" :class="{ 'change':isChange }">
|
||||
<view class="area-item">
|
||||
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
|
||||
<scroll-view :scroll-y="true" style="height: 100%">
|
||||
<up-cell-group>
|
||||
<up-cell v-for="(item,index) in provinces"
|
||||
:title="item.regionName" :arrow="false"
|
||||
:index="index" :key="index"
|
||||
@click="provinceChange(index)">
|
||||
<template v-slot:right-icon>
|
||||
<up-icon v-if="isChooseP&&province===index"
|
||||
size="17" name="checkbox-mark"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="area-item">
|
||||
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
|
||||
<scroll-view :scroll-y="true" style="height: 100%">
|
||||
<up-cell-group v-if="isChooseP">
|
||||
<up-cell v-for="(item,index) in citys"
|
||||
:title="item.regionName" :arrow="false"
|
||||
:index="index" :key="index"
|
||||
@click="cityChange(index)">
|
||||
<template v-slot:right-icon>
|
||||
<up-icon v-if="isChooseC&&city===index"
|
||||
size="17" name="checkbox-mark"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="area-item">
|
||||
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
|
||||
<scroll-view :scroll-y="true" style="height: 100%">
|
||||
<up-cell-group v-if="isChooseC">
|
||||
<up-cell v-for="(item,index) in areas"
|
||||
:title="item.regionName" :arrow="false"
|
||||
:index="index" :key="index"
|
||||
@click="areaChange(index)">
|
||||
<template v-slot:right-icon>
|
||||
<up-icon v-if="isChooseA&&area===index"
|
||||
size="17" name="checkbox-mark"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {region} from '@/http/api/system/region.js'
|
||||
import provinces from "../common/province.js";
|
||||
import citys from "../common/city.js";
|
||||
import areas from "../common/area.js";
|
||||
/**
|
||||
* city-select 省市区级联选择器
|
||||
* @property {String Number} z-index 弹出时的z-index值(默认1075)
|
||||
* @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
|
||||
* @property {String} default-region 默认选中的地区,中文形式
|
||||
* @property {String} default-code 默认选中的地区,编号形式
|
||||
*/
|
||||
export default {
|
||||
name: 'u-city-select',
|
||||
props: {
|
||||
// 通过双向绑定控制组件的弹出与收起
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 默认显示的地区,可传类似["河北省", "秦皇岛市", "北戴河区"]
|
||||
defaultRegion: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 默认显示地区的编码,defaultRegion和areaCode同时存在,areaCode优先,可传类似["13", "1303", "130304"]
|
||||
areaCode: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 是否允许通过点击遮罩关闭Picker
|
||||
maskCloseAble: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 弹出的z-index值
|
||||
zIndex: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cityValue: "",
|
||||
isChooseP: false, //是否已经选择了省
|
||||
province: 0, //省级下标
|
||||
provinces: [],
|
||||
isChooseC: false, //是否已经选择了市
|
||||
city: 0, //市级下标
|
||||
citys: citys[0],
|
||||
isChooseA: false, //是否已经选择了区
|
||||
area: 0, //区级下标
|
||||
areas: areas[0][0],
|
||||
tabsIndex: 0,
|
||||
list:[]
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
await this.getRegon()
|
||||
this.init();
|
||||
},
|
||||
computed: {
|
||||
isChange() {
|
||||
return this.tabsIndex > 1;
|
||||
},
|
||||
genTabsList() {
|
||||
let tabsList = [{
|
||||
name: "请选择"
|
||||
}];
|
||||
if (this.isChooseP) {
|
||||
console.log(this.province)
|
||||
tabsList[0]['name'] = this.provinces[this.province]['regionName'];
|
||||
tabsList[1] = {
|
||||
name: "请选择"
|
||||
};
|
||||
}
|
||||
if (this.isChooseC) {
|
||||
tabsList[1]['name'] = this.citys[this.city]['regionName'];
|
||||
tabsList[2] = {
|
||||
name: "请选择"
|
||||
};
|
||||
}
|
||||
if (this.isChooseA) {
|
||||
tabsList[2]['name'] = this.areas[this.area]['regionName'];
|
||||
}
|
||||
return tabsList;
|
||||
},
|
||||
uZIndex() {
|
||||
// 如果用户有传递z-index值,优先使用
|
||||
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
|
||||
}
|
||||
},
|
||||
emits: ['city-change'],
|
||||
methods: {
|
||||
async getRegon(){
|
||||
const res=await region()
|
||||
this.provinces=res||[]
|
||||
},
|
||||
init() {
|
||||
if (this.areaCode.length == 3) {
|
||||
this.setProvince("", this.areaCode[0]);
|
||||
this.setCity("", this.areaCode[1]);
|
||||
this.setArea("", this.areaCode[2]);
|
||||
} else if (this.defaultRegion.length == 3) {
|
||||
this.setProvince(this.defaultRegion[0], "");
|
||||
this.setCity(this.defaultRegion[1], "");
|
||||
this.setArea(this.defaultRegion[2], "");
|
||||
};
|
||||
},
|
||||
setProvince(regionName = "", value = "") {
|
||||
this.provinces.map((v, k) => {
|
||||
if (value ? v.value == value : v.regionName == regionName) {
|
||||
this.provinceChange(k);
|
||||
}
|
||||
})
|
||||
},
|
||||
setCity(regionName = "", value = "") {
|
||||
this.citys.map((v, k) => {
|
||||
if (value ? v.value == value : v.regionName == regionName) {
|
||||
this.cityChange(k);
|
||||
}
|
||||
})
|
||||
},
|
||||
setArea(regionName = "", value = "") {
|
||||
this.areas.map((v, k) => {
|
||||
if (value ? v.value == value : v.regionName == regionName) {
|
||||
this.isChooseA = true;
|
||||
this.area = k;
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:modelValue', false);
|
||||
},
|
||||
tabsChange(index) {
|
||||
this.tabsIndex = index;
|
||||
},
|
||||
provinceChange(index) {
|
||||
this.isChooseP = true;
|
||||
this.isChooseC = false;
|
||||
this.isChooseA = false;
|
||||
this.province = index;
|
||||
this.citys =this.provinces[index].children
|
||||
this.tabsIndex = 1;
|
||||
},
|
||||
cityChange(index) {
|
||||
this.isChooseC = true;
|
||||
this.isChooseA = false;
|
||||
this.city = index;
|
||||
this.areas =this.provinces[this.province].children[index].children
|
||||
this.tabsIndex = 2;
|
||||
},
|
||||
areaChange(index) {
|
||||
this.isChooseA = true;
|
||||
this.area = index;
|
||||
let result = {};
|
||||
result.province = this.provinces[this.province];
|
||||
result.city = this.citys[this.city];
|
||||
result.area = this.areas[this.area];
|
||||
this.$emit('city-change', result);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.area-box {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
height: 800rpx;
|
||||
|
||||
>view {
|
||||
width: 150%;
|
||||
transition: transform 0.3s ease-in-out 0s;
|
||||
transform: translateX(0);
|
||||
|
||||
&.change {
|
||||
transform: translateX(-33.3333333%);
|
||||
}
|
||||
}
|
||||
|
||||
.area-item {
|
||||
width: 33.3333333%;
|
||||
height: 800rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
35
entryManager/data.js
Normal file
35
entryManager/data.js
Normal file
@@ -0,0 +1,35 @@
|
||||
export const userTypes={
|
||||
'0':'个体商户',
|
||||
'1':'企业商户',
|
||||
}
|
||||
|
||||
export const contactPersonTypes={
|
||||
'LEGAL':'经营者/法定代表人',
|
||||
'SUPER':'经办人',
|
||||
}
|
||||
|
||||
export const certTypes={
|
||||
'0':'身份证'
|
||||
}
|
||||
|
||||
export const companyChildTypes={
|
||||
'1':'普通企业',
|
||||
'2':'事业单位',
|
||||
'3':'政府机关',
|
||||
'4':'社会组织',
|
||||
}
|
||||
|
||||
export const sexs={
|
||||
'0':'男',
|
||||
'1':'女'
|
||||
}
|
||||
|
||||
export const settlementTypes={
|
||||
'0':'非法人结算',
|
||||
'1':'法人结算'
|
||||
}
|
||||
|
||||
export const settlementCardTypes={
|
||||
'11':'对私借记卡',
|
||||
'21':'对公借记卡',
|
||||
}
|
||||
17
entryManager/index/index.vue
Normal file
17
entryManager/index/index.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28 color-333">
|
||||
<view class="container">1</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
</style>
|
||||
59
http/api/order/entryManager.js
Normal file
59
http/api/order/entryManager.js
Normal file
@@ -0,0 +1,59 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "order";
|
||||
|
||||
|
||||
// ocr识别填充
|
||||
export function getInfoByImg(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/getInfoByImg',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 查询银行支行列表
|
||||
export function bankBranchList(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/bankBranchList',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 获取进件信息
|
||||
export function entryManager(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
//主动查询进件信息状态
|
||||
export function queryEntry(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/queryEntry',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
//申请进件
|
||||
|
||||
|
||||
export function addEntryManager(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager',
|
||||
method: "POST",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
7
http/api/product/stick.js
Normal file
7
http/api/product/stick.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "product";
|
||||
|
||||
export function stickCount(file, data) {
|
||||
return http.upload(`${urlType}/admin/stick/count`,data,file)
|
||||
}
|
||||
@@ -15,6 +15,17 @@ export function getShopInfo(data, urlType = 'account') {
|
||||
})
|
||||
}
|
||||
|
||||
export function adminShopList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopInfo`,
|
||||
method: "get",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改店铺详情
|
||||
* @returns
|
||||
|
||||
23
http/api/system/common.js
Normal file
23
http/api/system/common.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "system";
|
||||
export function bankInfo(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/common/bankInfo',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function mccCategory(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/common/category',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
12
http/api/system/region.js
Normal file
12
http/api/system/region.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "system";
|
||||
export function region(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/common/region',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
17
http/http.js
17
http/http.js
@@ -16,22 +16,9 @@ import go from "@/commons/utils/go.js";
|
||||
import { reject } from "lodash";
|
||||
// 设置node环境
|
||||
// envConfig.changeEnv(storageManage.env('production')) //正式
|
||||
envConfig.changeEnv(storageManage.env("development")); //测试
|
||||
|
||||
// 测试服
|
||||
// #ifdef H5
|
||||
let baseUrl = "/javaapi/";
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// let baseUrl = 'https://tapi.cashier.sxczgkj.cn/'
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
// let baseUrl = 'https://cashier.sxczgkj.com/'
|
||||
let baseUrl = appConfig.env.JEEPAY_BASE_URL;
|
||||
// #endif
|
||||
// envConfig.changeEnv(storageManage.env("development")); //测试
|
||||
|
||||
let baseUrl = appConfig.returnBaseUrl({apiType:'java'});
|
||||
const loadingShowTime = 200;
|
||||
|
||||
function getHeader() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// const baseURL : string = 'https://newblockwlx.sxczgkj.cn/index.php/api/'
|
||||
let baseURL: string = "http://192.168.1.42:8787/api/";
|
||||
// #ifdef H5
|
||||
baseURL = "/phpapi/api/";
|
||||
baseURL = "/prodPhpApi/api/";
|
||||
// #endif
|
||||
|
||||
import go from "@/commons/utils/go.js";
|
||||
|
||||
@@ -14,24 +14,7 @@ import storageManage from '@/commons/utils/storageManage.js'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { reject } from 'lodash';
|
||||
// 设置node环境
|
||||
envConfig.changeEnv(storageManage.env('production'))
|
||||
// envConfig.changeEnv(storageManage.env('development'))
|
||||
|
||||
// 测试服
|
||||
// #ifdef H5
|
||||
let baseUrl = '/api/'
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// let baseUrl = 'https://tapi.cashier.sxczgkj.cn/'
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
// let baseUrl = 'https://cashier.sxczgkj.com/'
|
||||
let baseUrl = appConfig.env.JEEPAY_BASE_URL
|
||||
// #endif
|
||||
|
||||
let baseUrl = appConfig.returnBaseUrl({apiType:'php'});
|
||||
const loadingShowTime = 200
|
||||
|
||||
function getHeader(){
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"pinia-plugin-unistorage": "^0.1.2",
|
||||
"to-arraybuffer": "^1.0.1",
|
||||
"uview-plus": "^3.3.32",
|
||||
"ysk-utils": "^1.0.78"
|
||||
"ysk-utils": "^1.0.82"
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "^12.0.2",
|
||||
|
||||
@@ -213,7 +213,7 @@ function toMiniApp() {
|
||||
uni.navigateToMiniProgram({
|
||||
appId: 'wxd88fffa983758a30',
|
||||
path: `/groupBuying/goodsDetail/goodsDetail?wareId=${query.id}&shopId=${query.shopId}`,
|
||||
envVersion: 'trial', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||
envVersion: 'release', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||
success: () => {},
|
||||
fail: () => {}
|
||||
});
|
||||
|
||||
@@ -210,7 +210,7 @@ function toMiniApp() {
|
||||
uni.navigateToMiniProgram({
|
||||
appId: 'wxd88fffa983758a30',
|
||||
path: `/userPackage/goodsDetail/goodsDetail?id=${query.id}&shopId=${query.shopId}`,
|
||||
envVersion: 'trial', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||
envVersion: 'release', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||
success: () => {},
|
||||
fail: () => {}
|
||||
});
|
||||
|
||||
25
pages.json
25
pages.json
@@ -257,6 +257,13 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加临时菜"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "stick/stick",
|
||||
"pageId": "PAGES_CREATE_ORDER_STICK",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编辑"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -904,6 +911,24 @@
|
||||
"navigationBarTitleText": "分销"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "entryManager",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "进件管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "add/add",
|
||||
"style": {
|
||||
"navigationBarTitleText": "进件"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
<view class="u-flex-1 u-p-l-30 u-text-left">
|
||||
<view class="u-flex">
|
||||
<view class="u-line-1 u-font-36 font-bold" style="width: 80%;">{{shopInfo.shopName}}</view>
|
||||
<view class="u-font-28 color-fff change-shop u-flex u-row-center" @click="changeShop">
|
||||
<!-- <view class="u-font-28 color-fff change-shop u-flex u-row-center" @click="changeShop">
|
||||
<image src="/static/change.png" class="u-m-t-2" style="width: 20rpx;height: 20rpx;"
|
||||
mode=""></image>
|
||||
<text class="u-m-l-6">切换店铺</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<view style="color: rgba(255,255,255,0.83);" v-if="shopStaff">
|
||||
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
},
|
||||
async init() {
|
||||
const res = await menusStore.getMenus()
|
||||
const arr=res.filter(v => v.type == 0 && v.children.length && !v.hidden).map(v => {
|
||||
const arr=res.filter(v => v.type == 0 && v.children.length && !v.hidden && v.menuId!=1).map(v => {
|
||||
return {
|
||||
...v,
|
||||
children: v.children.filter(child => child.type == 0 && !child.hidden)
|
||||
|
||||
@@ -94,6 +94,19 @@
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-cell m">
|
||||
<view class="label">是否开启数签子</view>
|
||||
<view class="right">
|
||||
<up-switch
|
||||
v-model="vdata.shopInfo.isCountStick"
|
||||
size="20"
|
||||
:inactiveValue="0"
|
||||
:activeValue="1"
|
||||
activeColor="#0FC161"
|
||||
@change="switchChange('isCountStick')"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-cell m" style="display: block">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label">点餐电子围栏</view>
|
||||
@@ -449,6 +462,9 @@ let switchChange = (type) => {
|
||||
case "isOrderFence":
|
||||
params.isOrderFence = vdata.shopInfo.isOrderFence;
|
||||
break;
|
||||
case "isCountStick":
|
||||
params.isCountStick = vdata.shopInfo.isCountStick;
|
||||
break;
|
||||
}
|
||||
updateShopInfo(params);
|
||||
};
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
discount_sale_amount: form.price, //数量
|
||||
pack_number: 0, //数量
|
||||
is_gift: 0,
|
||||
remark:form.note,
|
||||
is_temporary: 1, //是否是临时菜
|
||||
}
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
@@ -247,6 +248,7 @@
|
||||
name: form.name,
|
||||
lowPrice: form.price,
|
||||
number: form.num,
|
||||
remark:form.note,
|
||||
is_temporary: 1, //是否是临时菜
|
||||
})
|
||||
clearInterval(timer)
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
>
|
||||
<image class="img" :src="item.coverImg" mode=""></image>
|
||||
</view>
|
||||
|
||||
<view
|
||||
style="
|
||||
background-color: #3f9eff;
|
||||
@@ -180,7 +181,7 @@
|
||||
"
|
||||
v-else
|
||||
>
|
||||
临时菜
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="u-m-l-32">
|
||||
<view class="u-flex">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
407
pagesCreateOrder/stick/stick.vue
Normal file
407
pagesCreateOrder/stick/stick.vue
Normal file
@@ -0,0 +1,407 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28 color-333 u-p-30">
|
||||
<view v-for="(item,index) in list" :key="index" class="block">
|
||||
<view class="font-bold u-font-32 ">序号{{index+1}}</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="font-bold u-m-b-14">单价</view>
|
||||
<view class="u-flex ">
|
||||
<up-input type="digit" placeholder="请输入单价" v-model="item.salePrice"
|
||||
@blur="salePriceBlur(item)"></up-input>
|
||||
<text class="u-m-l-24">元/根</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="font-bold u-m-b-14">数量</view>
|
||||
<up-input type="number" placeholder="请输入数量" v-model="item.number" @blur="numberBlur(item)"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bottom">
|
||||
<view class="font-bold">
|
||||
<text>合计:</text>
|
||||
<text class="color-red">{{totalMoney}}元</text>
|
||||
<text>/</text>
|
||||
<text>{{totalNumber}}根</text>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="btn main" @click="chooseImage">继续拍照</view>
|
||||
<view class="btn" @click="confirmOrder">下单</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
BigNumber
|
||||
} from "bignumber.js";
|
||||
import {
|
||||
computed,
|
||||
inject,
|
||||
onUnmounted,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
hasPermission
|
||||
} from "@/commons/utils/hasPermission.js";
|
||||
import {
|
||||
stickCount
|
||||
} from '@/http/api/product/stick.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app'
|
||||
import go from "@/commons/utils/go.js";
|
||||
import {
|
||||
createOrder,
|
||||
getHistoryOrder
|
||||
} from "@/http/api/order.js";
|
||||
|
||||
|
||||
const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例
|
||||
const totalMoney = computed(() => {
|
||||
return list.value.reduce((prve, cur) => {
|
||||
return prve.plus(BigNumber(cur.number || 0).times(cur.salePrice || 0))
|
||||
}, BigNumber(0)).toNumber()
|
||||
})
|
||||
const totalNumber = computed(() => {
|
||||
return list.value.reduce((prve, cur) => {
|
||||
return prve.plus(BigNumber(cur.number || 0))
|
||||
}, BigNumber(0)).toNumber()
|
||||
})
|
||||
|
||||
function chooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ["album", "camera "],
|
||||
success: async function(res) {
|
||||
uni.showLoading({
|
||||
title: "上传中",
|
||||
});
|
||||
console.log(res);
|
||||
const fileRes = await stickCount(res.tempFiles[0]);
|
||||
uni.hideLoading();
|
||||
if (fileRes) {
|
||||
list.value.push({
|
||||
number: fileRes,
|
||||
salePrice: 0
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "上传失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const list = ref([])
|
||||
const options = {}
|
||||
|
||||
function salePriceBlur(item) {
|
||||
console.log('item', item)
|
||||
if (item.salePrice * 1 <= 0) {
|
||||
item.salePrice = 0
|
||||
}
|
||||
if (item.salePrice.split('.')[1] && item.salePrice.split('.')[1].length > 2) {
|
||||
item.salePrice = Number(item.salePrice).toFixed(2)
|
||||
}
|
||||
}
|
||||
|
||||
function numberBlur(item) {
|
||||
if (item.number * 1 <= 0) {
|
||||
item.number = 0
|
||||
}
|
||||
if (item.number.split('.')[1] && item.number.split('.')[1].length >= 1) {
|
||||
item.number = Number(item.number.split('.')[0])
|
||||
}
|
||||
}
|
||||
|
||||
function init(opt) {
|
||||
Object.assign(options, opt)
|
||||
initCart()
|
||||
if (opt.number) {
|
||||
list.value = [{
|
||||
number: opt.number,
|
||||
salePrice: 0
|
||||
}]
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 初始化购物车
|
||||
*/
|
||||
function initCart() {
|
||||
let params = {
|
||||
type: "onboc",
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "init",
|
||||
table_code: options.tableCode,
|
||||
};
|
||||
console.log("购物车初始化参数===", params);
|
||||
websocketUtil.send(JSON.stringify(params));
|
||||
}
|
||||
/**
|
||||
* socket消息监听
|
||||
*/
|
||||
|
||||
let hasReciveMsgLen = 0
|
||||
|
||||
function onMessage() {
|
||||
websocketUtil.offMessage();
|
||||
websocketUtil.onMessage(async (res) => {
|
||||
let msg = JSON.parse(res);
|
||||
if (msg.msg_id) {
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "receipt",
|
||||
msg_id: msg.msg_id,
|
||||
})
|
||||
);
|
||||
}
|
||||
if (statWatchMsg && msg.operate_type == "onboc_add") {
|
||||
if (sendMsgsku_names.value.find(v => msg.data.sku_name == v)) {
|
||||
hasReciveMsgLen++
|
||||
}
|
||||
}
|
||||
if (statWatchMsg && hasReciveMsgLen) {
|
||||
createAnOrder()
|
||||
hasReciveMsgLen = 0
|
||||
statWatchMsg = false;
|
||||
sendMsgsku_names.value = []
|
||||
}
|
||||
console.log('msg', msg)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let sendMsgsku_names = ref([])
|
||||
let statWatchMsg = false
|
||||
|
||||
function confirmOrder() {
|
||||
const isPas = list.value.every(v => {
|
||||
if (!v.number) {
|
||||
return false
|
||||
}
|
||||
if (v.salePrice < 0) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
if (!isPas) {
|
||||
uni.showToast({
|
||||
title: '请输入正确的数量和单价',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
statWatchMsg = true;
|
||||
for (let item of list.value) {
|
||||
const shop_id = uni.getStorageSync("shopInfo").id
|
||||
const roundNum = Math.floor(Math.random() * 10)
|
||||
const roundNum1 = Math.floor(Math.random() * 1000)
|
||||
const sku_name = `签子_${roundNum}_${shop_id}_${options.tableCode}_${roundNum1}`
|
||||
sendMsgsku_names.value.push(sku_name)
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
shop_id,
|
||||
type: "onboc",
|
||||
operate_type: "add",
|
||||
table_code: options.tableCode,
|
||||
product_name: '签子',
|
||||
is_gift: 0,
|
||||
pack_number: 0,
|
||||
discount_sale_amount: item.salePrice,
|
||||
number: item.number * 1,
|
||||
sku_name,
|
||||
is_temporary: 1, //是否是临时菜
|
||||
is_qz: 1
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
// createAnOrder()
|
||||
// toConfimOrder()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
|
||||
async function createAnOrder() {
|
||||
const shopInfo = uni.getStorageSync('shopInfo')
|
||||
if (
|
||||
shopInfo.registerType == "before"
|
||||
) {
|
||||
const canJiesuan = await hasPermission("允许收款");
|
||||
if (!canJiesuan) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const stickData = uni.getStorageSync('stickData')
|
||||
const orderInfo = stickData.orderInfo
|
||||
|
||||
let placeNum = orderInfo ? orderInfo.placeNum + 1 : 1;
|
||||
let par = {
|
||||
shopId: shopInfo.id, //店铺Id
|
||||
userId: '', //用户Id
|
||||
tableCode: options.tableCode, //台桌编码
|
||||
dineMode: 'dine-in', //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
remark: '', //备注
|
||||
seatNum: 0, //用餐人数
|
||||
packFee: 0, //打包费
|
||||
originAmount: 0, //订单原金额(不包含打包费+餐位费)
|
||||
placeNum: placeNum, //当前订单下单次数
|
||||
waitCall: 0, //是否等叫 0 否 1 等叫
|
||||
vipPrice: 0, //是否使用会员价
|
||||
limitRate: stickData.limitTimeDiscount,
|
||||
};
|
||||
|
||||
if (stickData.orderInfo && shopInfo.registerType != "before") {
|
||||
par.orderId = stickData.orderInfo.id;
|
||||
}
|
||||
let res = null;
|
||||
res = await createOrder(par);
|
||||
console.log(res, "创建订单");
|
||||
if (!res) {
|
||||
uni.showToast({
|
||||
title: res.msg || "创建订单失败!",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.$emit("update:createOrderIndex");
|
||||
websocketUtil.send(
|
||||
JSON.stringify({
|
||||
type: "onboc",
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type: "cleanup",
|
||||
table_code: stickData.table.tableCode,
|
||||
})
|
||||
);
|
||||
uni.removeStorageSync("table_code");
|
||||
|
||||
if (
|
||||
shopInfo.registerType == "before"
|
||||
) {
|
||||
//先付
|
||||
return go.to(
|
||||
"PAGES_ORDER_DETAIL", {
|
||||
id: res.id || stickData.orderInfo.id,
|
||||
dinnerType: 'dine-in',
|
||||
},
|
||||
"redirect"
|
||||
);
|
||||
} else {
|
||||
if (!res.id && stickData.orderInfo.id) {
|
||||
return go.to(
|
||||
"PAGES_ORDER_PAY", {
|
||||
orderId: stickData.orderInfo.id,
|
||||
isNowPay: true,
|
||||
dinnerType: 'dine-in',
|
||||
},
|
||||
"redirect"
|
||||
);
|
||||
}
|
||||
//后付
|
||||
if (options.isCreateOrderToDetail != "0") {
|
||||
go.to(
|
||||
"PAGES_ORDER_DETAIL", {
|
||||
id: res.id || stickData.orderInfo.id,
|
||||
dinnerType: 'dine-in',
|
||||
},
|
||||
"redirect"
|
||||
);
|
||||
} else {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
uni.showToast({
|
||||
title: "提交成功",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
|
||||
function toConfimOrder() {
|
||||
const stickData = uni.getStorageSync('stickData')
|
||||
console.log(stickData);
|
||||
const {
|
||||
name,
|
||||
status,
|
||||
type
|
||||
} = stickData.table;
|
||||
|
||||
|
||||
let shopInfo = uni.getStorageSync("shopInfo");
|
||||
|
||||
go.to("PAGES_CONFIRM_ORDER", {
|
||||
type: type,
|
||||
tableId: stickData.table.id,
|
||||
tableCode: stickData.table.tableCode,
|
||||
name: name,
|
||||
status: status,
|
||||
isCreateOrderToDetail: options.isCreateOrderToDetail ? 1 : 0,
|
||||
});
|
||||
}
|
||||
|
||||
onLoad(init)
|
||||
|
||||
onHide(() => {
|
||||
console.log("onHide");
|
||||
websocketUtil.offMessage();
|
||||
});
|
||||
onShow(() => {
|
||||
onMessage();
|
||||
})
|
||||
onUnmounted(() => {
|
||||
console.log("onUnmounted");
|
||||
websocketUtil.offMessage();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.block {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
}
|
||||
|
||||
.bottom {
|
||||
display: flex;
|
||||
padding: 24rpx 32rpx;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding-bottom: 40rpx;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
|
||||
.btn {
|
||||
padding: 16rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #f2f2f2;
|
||||
margin-left: 24rpx;
|
||||
min-width: 188rpx;
|
||||
text-align: center;
|
||||
|
||||
&.main {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<image v-if="item.isTemporary == 0" class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||
<view v-else style="background-color: #3f9eff; width: 152rpx;height: 152rpx;line-height: 152rpx;text-align: center;color: #fff;" >
|
||||
临时菜
|
||||
{{item.name||item.productName||'临时菜'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-l-32 u-flex-1">
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-24">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>订单状态</view>
|
||||
<view>{{$dict.getDiceName(data.status,'orderStatus')}}</view>
|
||||
<view>{{ $dict.getDiceName(data.status, 'orderStatus') }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单类型</view>
|
||||
<view>{{$dict.getDiceName(data.dineMode,'dineMode')}}</view>
|
||||
<view>{{ $dict.getDiceName(data.dineMode, 'dineMode') }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>桌位号</view>
|
||||
<view>{{table.name||data.tableName}}</view>
|
||||
<view>{{ table.name || data.tableName }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24" v-if="seatFee.number">
|
||||
<view>就餐人数</view>
|
||||
<view>{{seatFee.number||''}}</view>
|
||||
<view>{{ seatFee.number || '' }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>支付方式</view>
|
||||
<view>{{$dict.getDiceName(data.payType,'payType')||''}}</view>
|
||||
<view>{{ $dict.getDiceName(data.payType, 'payType') || '' }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>下单时间</view>
|
||||
@@ -27,9 +27,9 @@
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单编号</view>
|
||||
<view class="u-flex">
|
||||
<view>{{data.orderNo}}</view>
|
||||
<view>{{ data.orderNo }}</view>
|
||||
<view v-if="data.orderNo" class="u-m-l-6">
|
||||
<up-copy :content="data.orderNo" >
|
||||
<up-copy :content="data.orderNo">
|
||||
<up-icon name="/static/copy.svg" :size="16"></up-icon>
|
||||
</up-copy>
|
||||
</view>
|
||||
@@ -37,34 +37,44 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
||||
<view class="no-wrap">商家备注</view>
|
||||
<view class="u-p-l-32 " style="max-width: 522rpx; word-wrap: break-word;">
|
||||
{{data.remark}}
|
||||
<view class="u-p-l-32" style="max-width: 522rpx; word-wrap: break-word">
|
||||
{{ data.remark }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
||||
<view class="no-wrap">打印状态</view>
|
||||
<view class="u-p-l-32" style="max-width: 522rpx; word-wrap: break-word; color: red">
|
||||
<template v-if="JSON.parse(data.printStatus).length > 0">
|
||||
打印失败({{
|
||||
JSON.parse(data.printStatus)
|
||||
.map((item) => item.name)
|
||||
.join('、')
|
||||
}})
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
totalNumber: 0
|
||||
}
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
totalNumber: 0;
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
1547
pnpm-lock.yaml
generated
1547
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -7,17 +7,25 @@ export default defineConfig({
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
'/javaapi': {
|
||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
'/prodJavaApi': {
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/prodJavaApi/, '')
|
||||
},
|
||||
'/testJavaApi': {
|
||||
target: 'http://192.168.1.42/', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/javaapi/, '')
|
||||
rewrite: path => path.replace(/^\/testJavaApi/, '')
|
||||
},
|
||||
'/phpapi': {
|
||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
'/prodPhpApi': {
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/prodPhpApi/, '')
|
||||
},
|
||||
'/testPhpApi': {
|
||||
target: 'http://192.168.1.42:8787/', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/phpapi/, '')
|
||||
rewrite: path => path.replace(/^\/testPhpApi/, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user