diff --git a/apis/commonApi.js b/apis/commonApi.js index e885094..0d2dc1f 100644 --- a/apis/commonApi.js +++ b/apis/commonApi.js @@ -88,148 +88,14 @@ export function getBaseInfo(data = {}, refresh = false) { } /** - * 获取当前账号的企业实名认证地址 - * @param {object} data 参数 enterpriseId + * 手机登录获取验证码接口 + * @param {object} data 获取验证码参数 + * @returns 获取验证码结果 + * swagger:http://api-ops-uec-test.qniao.cn/uec/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E7%99%BB%E5%BD%95%E8%AE%A4%E8%AF%81/authorizeByCaptchaUsingPOST */ -export function getVerifyUrl(data = {}) { +export const getAuthCaptcha = (data) => { return http.post({ - url: '/yyt-uec/get/fdd-enterprise-verify-url?enterpriseId=' + data.enterpriseId, + url: '/uec/get/auth-captcha', data }) } - -/** - * 生成担保合同的签约地址,同意纸盘商只需要签约一次即可 - * @param {object} data 参数 mallSupplierId - */ -export function getGuaranteeContract(data = {}) { - return http.post({ - url: '/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=' + data.mallSupplierId, - data - }) -} - -/** - * 获取当前账号企业的飞算额度 - * @param {object} data 参数 enterpriseId - */ -export function getFsCredit(data = {}) { - return http.get({ - url: '/yyt-uec/credit/get/enterprise-feisuan-credit', - data - }) -} - -/** - * 获取当前账号企业的被担保的月结额度 - * @param {object} data 参数 enterpriseId supplierId - */ -export function getMonthCredit(data = {}) { - return http.get({ url: '/yyt-uec/customer/get/supplier-credit', data }) -} - -/** - * 转换合同成图片 - * @param {object} data 图片地址链接 fileUrl - */ -export function transformFileToImg(data) { - return http.get({ - url: '/document/get/enterprise-documents/file-image-base64', - data: data - }) -} - -/** - * 获取飞算地址 - */ -export function getFeisuanUrl(data = {}) { - return http.get({ - url: '/yyt-uec/feisuan/feisuan-apply-url.json', - data: data - }) -} - -/** - * 营业执照OCR识别 photoUrl - */ -export function getLicenseOcr(data = {}) { - return http.post({ - url: '/base-paper-trading/ocr/business-license', - data: data - }) -} - -/** - * 身份证正面OCR识别 image - */ -export function getFrontIdCardOcr(data = {}) { - return http.post({ - url: '/base-paper-trading/ocr/id-card/face', - data: data - }) -} - -/** - * 身份证背面OCR识别 image - */ -export function getBackIdCardOcr(data = {}) { - return http.post({ - url: '/base-paper-trading/ocr/id-card/back', - data: data - }) -} - -/** - * 纸盘商开通会员,创建订单 - * @param {object} data - * @value {string} type - * @value {string} enterpriseId - */ -export function openVip(data = {}) { - return http.post({ - url: `/yyt-uec/customer/apply/for/vip?type=${data.type}&enterpriseId=${data.enterpriseId}`, - data: data - }) -} - -/** - * 纸盘商开通会员,真实支付 - * @param {object} data - * @value {string} tradeOrderId - * @value {string} channelId - * @param {string} userOpenId 用户openId - */ -export function openVipPay(data = {}) { - return http.post({ - url: PAY_URL + `?userOpenId=${data.userOpenId}`, - data: data - }) -} - -/** - * 获取用户openId - * @param {object} data - * @value {string} authCode 授权码 - * @value {string} authMethod 3:WeChatServiceAccount - */ -export function getOpenId(data = {}) { - return http.post({ - url: '/uec/get/user-openid/by-oauth2', - data: data - }) -} - -/** - * 绑定纸盘商销售id - * @param {object} data - * @value {string} customerEnterpriseId 客户企业id - * @value {string} customerId 客户id - * @value {string} sellerId 纸盘商销售id - * @value {string} sellerSupplierId 纸盘商id - */ -export function bindUser(data = {}) { - return http.post({ - url: '/yyt-uec/seller/bound/customer', - data: data - }) -} diff --git a/apis/deviceApi.js b/apis/deviceApi.js new file mode 100644 index 0000000..91af4e5 --- /dev/null +++ b/apis/deviceApi.js @@ -0,0 +1,40 @@ +import http from '@/utils/http/index.js' + +/** + * 校验分享id是否有密码 + * @param {object} data + * @value {string} id 分享id + */ +export function checkShareId(data = {}) { + return http.get({ + url: `/base-paper-trading/get/mechanical-equipment-share/${data.id}`, + data: data + }) +} + +/** + * 校验分享id的密码 + * @param {object} data + * @value {string} id 分享id + * @value {string} password 分享密码 + */ +export function checkSharePassword(data = {}) { + return http.post({ + url: `/base-paper-trading/check/mechanical-equipment-share/password`, + data: data + }) +} + +/** + * 获取设备详情 + * @param {object} data + * @value {string} id 分享id + * @value {string} startDate 开始时间 + * @value {string} endDate 结束时间 + */ +export function getShareDeviceInfo(data = {}) { + return http.get({ + url: `/base-paper-trading/get/mechanical-equipment/detail/${data.id}`, + data: data + }) +} diff --git a/apis/factoryApi.js b/apis/factoryApi.js new file mode 100644 index 0000000..f70438c --- /dev/null +++ b/apis/factoryApi.js @@ -0,0 +1,85 @@ +import http from '@/utils/http/index.js' + +/** + * 查询工厂信息 + * + */ +export function getFactoryInfo(data = {}) { + return http.get({ + url: `/yyt-uec/get/factory/information/${data.id}`, + data + }) +} + +/** + * 获取设备列表 + */ +export function getEquipmentList(data = {}) { + return http.get({ + url: '/base-paper-trading/get/mechanical-equipment/extension-list', + data + }) +} + +/** + * 获取产品列表 + */ +export function getProductionList(data = {}) { + return http.get({ + url: '/base-paper-trading/get/packagingProduct/list', + data + }) +} +/** + * 获取申请验厂详情 + */ +export function getApplyInfo(data = {}) { + return http.get({ + url: `/base-paper-trading/get/factory-inspection/${data.id}`, + data + }) +} + +/** + * 获取设备信息 + */ +export function getEquipmentInfo(data = {}) { + return http.get({ + url: `/base-paper-trading/get/mechanical-equipment/${data.id}`, + data + }) +} + +/** + * 获取产品详情 + * @param {object} data + * @property {string} id + */ +export function getProductionInfo(data = {}) { + return http.get({ + url: `/base-paper-trading/get/packagingProduct/${data.id}`, + data + }) +} + +/** + * 用户申请验厂 + * @param {object} data + * @property {string} id + */ +export function userApplying(data = {}) { + return http.post({ + url: `/base-paper-trading/apply/for-factory-inspection`, + data + }) +} + +/** + * 获取监控设备的token + */ +export function getAccessToken(data = {}) { + return http.get({ + url: `/base-paper-trading/get/mechanical-equipment/monitor/token`, + data + }) +} diff --git a/components/qn-easyinput/qn-easyinput.vue b/components/qn-easyinput/qn-easyinput.vue index bda6e06..9035cd5 100644 --- a/components/qn-easyinput/qn-easyinput.vue +++ b/components/qn-easyinput/qn-easyinput.vue @@ -232,23 +232,12 @@ export default { }, watch: { value(newVal) { - if (this.errMsg) this.errMsg = '' - this.val = newVal - // fix by mehaotian is_reset 在 uni-forms 中定义 - if (this.form && this.formItem && !this.is_reset) { - this.is_reset = false - this.formItem.setValue(newVal) - } + this.resetValue(newVal) }, modelValue(newVal) { - if (this.errMsg) this.errMsg = '' - this.val = newVal - if (this.form && this.formItem && !this.is_reset) { - this.is_reset = false - this.formItem.setValue(newVal) - } + this.resetValue(newVal) }, - focus(newVal) { + focus() { this.$nextTick(() => { this.focused = this.focus }) @@ -280,6 +269,17 @@ export default { }) }, methods: { + /** + * 监听value 和 modelValue 变化 + */ + resetValue(newVal) { + if (this.errMsg) this.errMsg = '' + this.val = newVal + if (this.form && this.formItem && !this.is_reset) { + this.is_reset = false + this.formItem.setValue(newVal) + } + }, onClickIcon(type) { this.$emit('iconClick', type) }, @@ -313,9 +313,7 @@ export default { } if (this.errMsg) this.errMsg = '' this.val = value - // 兼容 vue2 this.$emit('input', value) - // 兼容 vue3 this.$emit('update:modelValue', value) }, @@ -330,10 +328,7 @@ export default { }, onClear() { this.val = '' - // 兼容 vue2 this.$emit('input', '') - // 兼容 vue2 - // 兼容 vue3 this.$emit('update:modelValue', '') }, fieldClick() { @@ -381,7 +376,8 @@ $uni-border-1: #dcdfe6 !default; width: 100%; display: flex; box-sizing: border-box; - min-height: 36px; + // min-height: 21px; + height: 100%; /* #endif */ flex-direction: row; align-items: center; diff --git a/enums/index.js b/enums/index.js index 1243f99..580fc87 100644 --- a/enums/index.js +++ b/enums/index.js @@ -7,6 +7,13 @@ export const XAPPID = '503258978847966408' export const PAY_URL = `https://api-client-psc${urlEnv}.qniao.cn/payment-settlement-center/pay-for-service-account` // 当前支付页面地址 export const VIP_URL = `https://shopkeeper${urlEnv}.qniao.cn/#/pages/vip-center/index` +/** + * 萤石云直播地址 + * @param {string} accessToken 访问令牌 + * @param {string} deviceSerial 设备序列号 + * @param {string} channelNo 通道号 + */ +export const YINGSHI_LIVE_URL = `https://open.ys7.com/ezopen/h5/live?autoplay=1&audio=1&hd=1&` /** * 账号类型 @@ -28,32 +35,21 @@ export const encryptType = { } /** - * 验证码用途 + * 是否加密 不加密:0 , 加密:1 */ -export const codePurpose = { - CERTIFICATION: 1, - RESET_LOGIN_PASSWORD: 2, - RESET_PHONE: 3, - BIND_BANK_CARD: 4, - RESET_CREDIT_PASSWORD: 5 +export const isEncrypt = { + NO: 0, + YES: 1 } /** - * 可验证账号类型 - */ -export const verificationType = { - PHONE: 1, - EMAIL: 2 -} -/** - * 法大大企业认证状态 1:未认证 2:认证中 3:已认证 4:认证失败 + * 文件类型 图片:1,视频:2 */ -export const fddEnterpriseStatus = { - UNCERTIFIED: 1, - CERTIFIED_ING: 2, - CERTIFIED_SUCCESS: 3, - CERTIFIED_FAIL: 4 +export const fileType = { + IMG: 1, + VIDEO: 2 } + /** * 上传地址 */ @@ -62,191 +58,28 @@ export const uploadUrl = { file: `https://api-client-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/file` } /** - * 结算周期:1:月结30(飞算1期),2:月结45,3:月结60(飞算2期),4:月结75,5:月结90(飞算3期) - */ -export const settlementPeriodEnum = [ - { - value: 1, - label: '月结30' - }, - { - value: 2, - label: '月结45' - }, - { - value: 3, - label: '月结60' - }, - { - value: 4, - label: '月结75' - }, - { - value: 5, - label: '月结90' - } -] -/** - * 结算周期:1:1期,2:2期,3:3期 - */ -export const fsSettlementPeriodEnum = [ - { - value: 1, - label: '1期' - }, - { - value: 2, - label: '2期' - }, - { - value: 3, - label: '3期' - } -] -/** - * 飞算结算方式: 1: 先息后本 - */ -export const fsSettlementMethodEnum = [ - { - value: 1, - label: '先息后本' - } -] - -/** - * 飞算授信审核状态 0: 待客户申请 1: 审核中 2: 通过 3: 拒绝 + * 申请状态 1:已提交 2:已同意 3:已拒绝 */ -export const fsAuditStatus = { - WAIT_APPLY: 0, - AUDITING: 1, - PASS: 2, +export const applyStatus = { + SUBMIT: 1, + AGREE: 2, REJECT: 3 } /** - * 客户订单状态 0: 全部 ; 30100: 待确认 ; 30204: 待供应商确认 ; 30101: 已下单 ; 30104: 已完成 ; 30105: 已取消 - */ -export const orderStatusEnum = { - ALL: 0, - WAIT_CONFIRM: 30100, - WAIT_SUPPLIER_CONFIRM: 30204, - ORDERED: 30101, - FINISHED: 30104, - CANCELED: 30105 -} - -/** - * 客户订单状态 0: 全部 ; 30100: 待确认 ; 30204: 待供应商确认 ; 30101: 已下单 ; 30104: 已完成 ; - */ -export const orderStatusArray = [ - { - value: orderStatusEnum.ALL, - label: '全部' - }, - { - value: orderStatusEnum.WAIT_CONFIRM, - label: '待确认' - }, - { - value: orderStatusEnum.WAIT_SUPPLIER_CONFIRM, - label: '待供应商确认' - }, - { - value: orderStatusEnum.ORDERED, - label: '已下单' - }, - { - value: orderStatusEnum.FINISHED, - label: '已完成' - }, - { - value: orderStatusEnum.CANCELED, - label: '已取消' - } -] - -export const orderStatusMap = { - [orderStatusEnum.ALL]: '全部', - [orderStatusEnum.WAIT_CONFIRM]: '待确认', - [orderStatusEnum.WAIT_SUPPLIER_CONFIRM]: '待供应商确认', - [orderStatusEnum.ORDERED]: '已下单', - [orderStatusEnum.FINISHED]: '已完成', - [orderStatusEnum.CANCELED]: '已取消' -} - -/** - * 供应商订单状态 待客户确认订单/30202,待供应商确认订单/30205,待发货/30106,已发货/30107 已发货在H5客户端显示 待收货/30107 ,待客户借款/30207,支付中/30208,待客户支付/30214,付款失败/30211,已完成/30213,待客户还款/30217,已取消/30212,还款中/30216 - */ -export const supplierOrderStatusEnum = { - WAIT_CLIENT_CONFIRM: 30202, - WAIT_SUPPLIER_CONFIRM: 30205, - WAIT_DELIVERY: 30106, - WAIT_RECEIVE: 30107, - WAIT_CLIENT_LOAN: 30207, - PAYING: 30208, - WAIT_CLIENT_PAY: 30214, - PAY_FAIL: 30211, - FINISHED: 30213, - WAIT_CLIENT_REPAY: 30217, - REPAYING: 30216, - CANCELED: 30212 -} -/** - * 供应商订单状态 待客户确认订单/30202,待供应商确认订单/30205,待发货/30106,已发货/30107 已发货在H5客户端显示 待收货/30107 ,待客户借款/30207,支付中/30208,待客户支付/30214,付款失败/30211,已完成/30213,待客户还款/30217,已取消/30212,还款中/30216 - */ -export const supplierOrderStatusMap = { - [supplierOrderStatusEnum.WAIT_CLIENT_CONFIRM]: '待客户确认', - [supplierOrderStatusEnum.WAIT_SUPPLIER_CONFIRM]: '待供应商确认', - [supplierOrderStatusEnum.WAIT_DELIVERY]: '待发货', - [supplierOrderStatusEnum.WAIT_RECEIVE]: '待收货', - [supplierOrderStatusEnum.WAIT_CLIENT_LOAN]: '待借款', - [supplierOrderStatusEnum.PAYING]: '支付中', - [supplierOrderStatusEnum.WAIT_CLIENT_PAY]: '待支付', - [supplierOrderStatusEnum.PAY_FAIL]: '付款失败', - [supplierOrderStatusEnum.FINISHED]: '已完成', - [supplierOrderStatusEnum.WAIT_CLIENT_REPAY]: '待还款', - [supplierOrderStatusEnum.REPAYING]: '还款中', - [supplierOrderStatusEnum.CANCELED]: '已取消' -} - -/** - * 支付方式 1:微信支付 2:月结支付 4:飞算支付 - */ -export const paymentMethodEnum = { - WECHAT_PAY: 1, - MONTHLY_PAY: 2, - FLY_PAY: 4 -} - -export const paymentMethodMap = { - [paymentMethodEnum.WECHAT_PAY]: '微信支付', - [paymentMethodEnum.MONTHLY_PAY]: '月结支付', - [paymentMethodEnum.FLY_PAY]: '飞算支付' -} - -/** - * 订单是否开票: 1:开票 0:不开票 - * 默认开票 + * 验证码用途 */ -export const invoiceStatusEnum = { - INVOICE: 1, - NO_INVOICE: 0 -} - -export const invoiceStatusMap = { - [invoiceStatusEnum.INVOICE]: '开票', - [invoiceStatusEnum.NO_INVOICE]: '不开票' +export const codePurpose = { + CERTIFICATION: 1, + RESET_LOGIN_PASSWORD: 2, + RESET_PHONE: 3, + BIND_BANK_CARD: 4, + RESET_CREDIT_PASSWORD: 5 } - /** - * 库存单位 1:张 2:吨 + * 可验证账号类型 */ -export const stockUnitEnum = { - SHEET: 1, - TON: 2 -} - -export const stockUnitMap = { - [stockUnitEnum.SHEET]: '张', - [stockUnitEnum.TON]: '吨' +export const verificationType = { + PHONE: 1, + EMAIL: 2 } diff --git a/env/index.js b/env/index.js index bcf6a22..a0bfcb1 100644 --- a/env/index.js +++ b/env/index.js @@ -1,8 +1,8 @@ /** * @description 唯一环境变量 */ -// const env = 'test' +const env = 'test' // const env = 'dev' -const env = 'production' +// const env = 'production' export default env diff --git a/pages.json b/pages.json index 000a6a7..7d9e1b1 100644 --- a/pages.json +++ b/pages.json @@ -1,35 +1,5 @@ { "pages": [ - { - "path": "pages/store/index", - "style": { - "navigationBarTitleText": "店铺首页", - "navigationStyle": "custom" - }, - "h5": { "titleNView": false } - }, - { - "path": "pages/cart/index", - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "购物车" - } - }, - { - "path": "pages/mine/index", - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "个人中心" - } - }, - { - "path": "pages/login/index", - "style": { - "navigationBarTitleText": "登录", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, { "path": "pages/agreement/index", "style": { @@ -46,123 +16,52 @@ } }, { - "path": "pages/notification-page/index", + "path": "pages/device-info/index", "style": { - "navigationBarTitleText": "统一第三方通知页面", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/enterprise-info/index", - "style": { - "navigationBarTitleText": "完善企业信息", + "navigationBarTitleText": "设备信息", "enablePullDownRefresh": false, "navigationStyle": "custom" } }, { - "path": "pages/enterprise-info-edit/index", + "path": "pages/device-production-detail/index", "style": { - "navigationBarTitleText": "修改企业信息", + "navigationBarTitleText": "设备生产详情", "enablePullDownRefresh": false, "navigationStyle": "custom" } }, { - "path": "pages/address-manage/index", + "path": "pages/factory-inspection/index", "style": { - "navigationBarTitleText": "收货地址", + "navigationBarTitleText": "远程验厂", "enablePullDownRefresh": false, "navigationStyle": "custom" } }, { - "path": "pages/error/index", + "path": "pages/production-info/index", "style": { - "navigationBarTitleText": "页面不存在", + "navigationBarTitleText": "产品信息", "enablePullDownRefresh": false, "navigationStyle": "custom" } }, { - "path": "pages/order-list/index", + "path": "pages/apply-inspection/index", "style": { - "navigationBarTitleText": "订单列表", + "navigationBarTitleText": "验厂申请", "enablePullDownRefresh": false, "navigationStyle": "custom" } }, { - "path": "pages/order-make/index", + "path": "pages/certification/index", "style": { - "navigationBarTitleText": "创建订单", + "navigationBarTitleText": "信息验证", "enablePullDownRefresh": false, "navigationStyle": "custom" } - }, - { - "path": "pages/order-detail/index", - "style": { - "navigationBarTitleText": "订单详情", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - { - "path": "pages/paper-details/index", - "style": { - "navigationBarTitleText": "纸品详情", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/enquiry-list/index", - "style": { - "navigationBarTitleText": "询价列表", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/for-comparison/index", - "style": { - "navigationBarTitleText": "实单询比价", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/add-address-manage/index", - "style": { - "navigationBarTitleText": "新建收货地址", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/account-management/index", - "style": { - "navigationBarTitleText": "账号管理", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/add-account/index", - "style": { - "navigationBarTitleText": "新增企业账号", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/vip-center/index", - "style": { - "navigationBarTitleText": "会员中心", - "navigationStyle": "custom", - "enablePullDownRefresh": false - } } ], "globalStyle": { @@ -171,32 +70,6 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" }, - "tabBar": { - "color": "#888", - "selectedColor": "#007AFF", - "borderStyle": "white", - "backgroundColor": "#f9f9f9", - "list": [ - { - "pagePath": "pages/store/index", - "iconPath": "static/imgs/tabbar/store-gray.png", - "selectedIconPath": "static/imgs/tabbar/store-blue.png", - "text": "店铺首页" - }, - { - "pagePath": "pages/cart/index", - "iconPath": "static/imgs/tabbar/cart-gray.png", - "selectedIconPath": "static/imgs/tabbar/cart-blue.png", - "text": "购物车" - }, - { - "pagePath": "pages/mine/index", - "iconPath": "static/imgs/tabbar/mine-gray.png", - "selectedIconPath": "static/imgs/tabbar/mine-blue.png", - "text": "个人中心" - } - ] - }, "condition": { //模式配置,仅开发期间生效 "current": 0, //当前激活的模式(list 的索引项) diff --git a/pages/agreement/index.vue b/pages/agreement/index.vue new file mode 100644 index 0000000..f6506b5 --- /dev/null +++ b/pages/agreement/index.vue @@ -0,0 +1,82 @@ + + + + diff --git a/pages/apply-inspection/index.vue b/pages/apply-inspection/index.vue new file mode 100644 index 0000000..289a79e --- /dev/null +++ b/pages/apply-inspection/index.vue @@ -0,0 +1,246 @@ + + + + + diff --git a/pages/certification/index.vue b/pages/certification/index.vue new file mode 100644 index 0000000..f22ffad --- /dev/null +++ b/pages/certification/index.vue @@ -0,0 +1,223 @@ + + + + + diff --git a/pages/device-info/index.vue b/pages/device-info/index.vue new file mode 100644 index 0000000..5bd15a7 --- /dev/null +++ b/pages/device-info/index.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/pages/device-production-detail/index.vue b/pages/device-production-detail/index.vue new file mode 100644 index 0000000..6a29e71 --- /dev/null +++ b/pages/device-production-detail/index.vue @@ -0,0 +1,241 @@ + + + + + diff --git a/pages/factory-inspection/Banner.vue b/pages/factory-inspection/Banner.vue new file mode 100644 index 0000000..5c8e963 --- /dev/null +++ b/pages/factory-inspection/Banner.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/pages/factory-inspection/index.vue b/pages/factory-inspection/index.vue new file mode 100644 index 0000000..e997a76 --- /dev/null +++ b/pages/factory-inspection/index.vue @@ -0,0 +1,576 @@ + + + + + diff --git a/pages/page-view/index.vue b/pages/page-view/index.vue new file mode 100644 index 0000000..0c689c6 --- /dev/null +++ b/pages/page-view/index.vue @@ -0,0 +1,64 @@ + + + diff --git a/pages/production-info/index.vue b/pages/production-info/index.vue new file mode 100644 index 0000000..00684f7 --- /dev/null +++ b/pages/production-info/index.vue @@ -0,0 +1,134 @@ + + + + + diff --git a/static/imgs/device-info/camera-bg.png b/static/imgs/device-info/camera-bg.png new file mode 100644 index 0000000..d5574b3 Binary files /dev/null and b/static/imgs/device-info/camera-bg.png differ diff --git a/static/imgs/device-info/clock.png b/static/imgs/device-info/clock.png new file mode 100644 index 0000000..5820a23 Binary files /dev/null and b/static/imgs/device-info/clock.png differ diff --git a/static/imgs/device-info/close-icon.png b/static/imgs/device-info/close-icon.png new file mode 100644 index 0000000..e7f0645 Binary files /dev/null and b/static/imgs/device-info/close-icon.png differ diff --git a/static/imgs/device-info/device-detail-bg.png b/static/imgs/device-info/device-detail-bg.png new file mode 100644 index 0000000..6b2bc5c Binary files /dev/null and b/static/imgs/device-info/device-detail-bg.png differ diff --git a/static/imgs/device-info/down-arrow-icon.png b/static/imgs/device-info/down-arrow-icon.png new file mode 100644 index 0000000..69b80c9 Binary files /dev/null and b/static/imgs/device-info/down-arrow-icon.png differ diff --git a/static/imgs/device-info/factory-avatar.png b/static/imgs/device-info/factory-avatar.png new file mode 100644 index 0000000..e149b28 Binary files /dev/null and b/static/imgs/device-info/factory-avatar.png differ diff --git a/static/imgs/device-info/gear.png b/static/imgs/device-info/gear.png new file mode 100644 index 0000000..a70f3d6 Binary files /dev/null and b/static/imgs/device-info/gear.png differ diff --git a/static/imgs/device-info/logo.png b/static/imgs/device-info/logo.png new file mode 100644 index 0000000..f2f3e69 Binary files /dev/null and b/static/imgs/device-info/logo.png differ diff --git a/static/imgs/device-info/select-icon.png b/static/imgs/device-info/select-icon.png new file mode 100644 index 0000000..ae14505 Binary files /dev/null and b/static/imgs/device-info/select-icon.png differ diff --git a/static/imgs/device-info/selected-icon.png b/static/imgs/device-info/selected-icon.png new file mode 100644 index 0000000..9d4afc1 Binary files /dev/null and b/static/imgs/device-info/selected-icon.png differ diff --git a/static/imgs/factory/address-icon.png b/static/imgs/factory/address-icon.png new file mode 100644 index 0000000..5eb5fdc Binary files /dev/null and b/static/imgs/factory/address-icon.png differ diff --git a/static/imgs/factory/phone-blue-icon.png b/static/imgs/factory/phone-blue-icon.png new file mode 100644 index 0000000..39cdc30 Binary files /dev/null and b/static/imgs/factory/phone-blue-icon.png differ diff --git a/store/index.js b/store/index.js index 0d3eac1..433e153 100644 --- a/store/index.js +++ b/store/index.js @@ -1,7 +1,6 @@ import Vue from 'vue' import Vuex from 'vuex' import { isObject, isArray } from '@/utils/is' -import { bindUser } from '@/apis/commonApi' let qnToken = null, /** @@ -11,43 +10,25 @@ let qnToken = null, * @value mobile 手机号 */ userInfo = null, - /** - * @value id 企业id - * @value name 企业名称 - * @value fddEnterpriseStatus 法大大认证状态 。1未认证,2认证进行中,3认证成功,4认证失败 - * @value isVip 是否是vip - * @value vipExpireTime vip过期时间 - */ - companyInfo = null, uecToken = null, - searchHistory = null, /** - * @value supplierId 当前被分享的供应商id + * @value id 当前被分享的供应商账号id */ - supplierId = null, + userId = null, /** - * @value id 当前被分享的供应商账号id + * @value shareExpireTime 申请验厂通过的过期时间 */ - userId = null -const companyInfoParams = ['id', 'name', 'fddEnterpriseStatus', 'isVip', 'vipExpireTime'] + shareExpireTime = 0 const userInfoParams = ['name', 'userId', 'mobile', 'avatar'] try { uecToken = uni.getStorageSync('uecToken') qnToken = uni.getStorageSync('qnToken') - supplierId = uni.getStorageSync('supplierId') userId = uni.getStorageSync('userId') + shareExpireTime = uni.getStorageSync('shareExpireTime') userInfo = uni.getStorageSync('userInfo') - searchHistory = uni.getStorageSync('searchHistory') - if (searchHistory) { - searchHistory = JSON.parse(searchHistory) - } if (userInfo) { userInfo = JSON.parse(userInfo) } - companyInfo = uni.getStorageSync('companyInfo') - if (companyInfo) { - companyInfo = JSON.parse(companyInfo) - } } catch (e) { console.error('初始化错误:', e) } @@ -57,15 +38,13 @@ const store = new Vuex.Store({ state: { uecToken: uecToken || '', qnToken: qnToken || '', // token - supplierId: supplierId || '', // 供应商id userId: userId || '', // 供应商账号id userInfo: userInfo || {}, // 用户信息 - companyInfo: companyInfo || {}, // 印包厂信息 + shareExpireTime: shareExpireTime || 0, // 申请验厂通过的过期时间 nextPage: { name: '', data: {} }, - searchHistory: searchHistory || [], /** * 监听cache的type即可,每次取值后都必须调用commit('resetCache') */ @@ -166,66 +145,6 @@ const store = new Vuex.Store({ console.error('删除userInfo失败:', e) } }, - setCompanyInfo(state, companyInfo) { - if (!isObject(companyInfo)) { - console.error('companyInfo必须是对象') - return - } - for (let companyInfoParam of companyInfoParams) { - if (companyInfo[companyInfoParam] === undefined) { - console.error(`companyInfo必须包含${companyInfoParam}`) - return - } - } - try { - uni.setStorageSync('companyInfo', JSON.stringify(companyInfo)) - state.companyInfo = companyInfo - // 绑定供应商销售账号 - if (state.userId && state.userInfo.userId) { - bindUser({ - customerEnterpriseId: companyInfo.id, - sellerId: state.userId, - sellerSupplierId: state.supplierId, - customerId: state.userInfo.userId - }) - } - } catch (e) { - console.error('设置companyInfo失败:', e) - } - }, - /** - * 更改当前供应商信息 - * @param {*} state 状态 - * @param {arr} map 以key-value形式存储的数组 - * @value key 需要更改的key - * @value value 更改后的值 - */ - changeCompanyInfo(state, map) { - if (!isArray(map)) { - console.error('map必须是数组') - return - } - let companyInfo = state.companyInfo - map.forEach((item) => { - if (companyInfoParams.includes(item.key)) { - companyInfo[item.key] = item.value - } - }) - try { - uni.setStorageSync('companyInfo', JSON.stringify(companyInfo)) - state.companyInfo = companyInfo - } catch (e) { - console.error('更改companyInfo失败:', e) - } - }, - removeCompanyInfo(state) { - try { - uni.removeStorageSync('companyInfo') - state.companyInfo = {} - } catch (e) { - console.error('删除companyInfo失败:', e) - } - }, setNextPage(state, nextPage) { if (!isObject(nextPage)) { console.error('nextPage必须是对象') @@ -238,42 +157,6 @@ const store = new Vuex.Store({ state.nextPage.name = '' state.nextPage.data = {} }, - setSearchHistory(state, searchHistory) { - if (!isArray(searchHistory)) { - console.error('searchHistory必须是数组') - return - } - try { - uni.setStorageSync('searchHistory', JSON.stringify(searchHistory)) - state.searchHistory = searchHistory - } catch (e) { - console.error('更改searchHistory失败:', e) - } - }, - clearSearchHistory(state) { - try { - uni.removeStorageSync('searchHistory') - state.searchHistory = [] - } catch (e) { - console.error('删除searchHistory失败:', e) - } - }, - setSupplierId(state, id) { - try { - uni.setStorageSync('supplierId', id) - state.supplierId = id - } catch (e) { - console.error('更改supplierId失败:', e) - } - }, - removeSupplierId(state) { - try { - uni.removeStorageSync('supplierId') - state.supplierId = '' - } catch (e) { - console.error('删除supplierId失败:', e) - } - }, setUserId(state, id) { try { uni.setStorageSync('userId', id) @@ -289,6 +172,22 @@ const store = new Vuex.Store({ } catch (e) { console.error('删除userId失败:', e) } + }, + setShareExpireTime(state, timeStamp) { + try { + uni.setStorageSync('shareExpireTime', timeStamp) + state.shareExpireTime = timeStamp + } catch (e) { + console.error('更改shareExpireTime失败:', e) + } + }, + removeShareExpireTime(state) { + try { + uni.removeStorageSync('shareExpireTime') + state.shareExpireTime = 0 + } catch (e) { + console.error('删除shareExpireTime失败:', e) + } } }, actions: { @@ -296,19 +195,6 @@ const store = new Vuex.Store({ commit('removeUecToken') commit('removeToken') commit('removeUserInfo') - commit('removeCompanyInfo') - }, - addSearchHistory({ commit, state }, searchHistory) { - let arr = [...state.searchHistory] // 单层数组直接解构 - let index = arr.findIndex((item) => item === searchHistory) - if (index > -1) { - arr.splice(index, 1) - } - arr.unshift(searchHistory) - if (arr.length > 10) { - arr = arr.slice(0, 10) - } - commit('setSearchHistory', arr) } } }) diff --git a/utils/http/index.js b/utils/http/index.js index e73a118..4898e2b 100644 --- a/utils/http/index.js +++ b/utils/http/index.js @@ -107,7 +107,7 @@ const resInterceptor = (response, options) => { return res.data === null ? 1 : res.data } else { uni.showToast({ - title: res.message, + title: res.message || res.msg, icon: 'none' }) return null diff --git a/utils/index.js b/utils/index.js index 4f56034..34f1cb7 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,6 +1,6 @@ import env from '@/env/index.js' import store from '@/store/index.js' -import { isDate, isString } from './is.js' +import { isDate, isString, isArray } from './is.js' /** * 日期格式化,样例 yyyy-mm-dd hh:MM:ss * @param date Date 需要转换的日期 @@ -164,3 +164,39 @@ export const difTime = (time, target) => { seconds } } + +/** + * 根据规则校验字段 + * @param {*} value 输入值 + * @param {array} rules 规则集 {type,required,message} + * @value {boolean} required 是否必填 + * @value {string} type 字段类型校验,目前支持 phone + * @returns {object} {isValid,msg} + */ +export const validateField = (value, rules) => { + let isValid = true + let msg = '' + for (let rule of rules) { + if (rule.required) { + if (value === '' || value === undefined || value === null) { + isValid = false + msg = rule.message + break + } + if (isArray(value) && value.length === 0) { + isValid = false + msg = rule.message + break + } + } + if (rule.type === 'phone' && value !== '' && !/^1[3456789]\d{9}$/.test(value)) { + isValid = false + msg = rule.message + break + } + } + return { + isValid, + msg + } +}