diff --git a/.gitignore b/.gitignore index 17fa7b4..eb6c89d 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /unpackage +/node_modules /utils/request-1.js diff --git a/config.js b/config.js index bd5ce00..b08c1eb 100755 --- a/config.js +++ b/config.js @@ -2,9 +2,9 @@ module.exports = { // 系统名称 name: "云芯威BMS", - // apiUrl: "https://yxw.wsdns.cn/api", // 生产环境 - apiUrl: "http://127.0.0.1:9090/api", // 开发环境 - // apiUrl: "http://1.14.132.108:10050/api", + apiUrl: "https://yxw.wsdns.cn/api", // 生产环境 + // apiUrl: "http://127.0.0.1:9090/api", // 开发环境 + // apiUrl: "http://1.14.132.108:10090/api",// 内网穿透 uploadUrl: 'https://file.wsdns.cn', fileUrl: 'https://oss-yunxinwei.oss-cn-shenzhen.aliyuncs.com', diff --git a/pages/checkout/cashier/index.vue b/pages/checkout/cashier/index.vue index f043427..68e9ff5 100755 --- a/pages/checkout/cashier/index.vue +++ b/pages/checkout/cashier/index.vue @@ -76,7 +76,7 @@ PayStatusEnum } from '@/common/enum/order' import { - getOrder, + getOrderPay, setPayStatus } from '@/websoft/api/order.js' import { @@ -181,7 +181,7 @@ } = this app.isLoading = true // 加载订单 - getOrder(orderId) + getOrderPay(orderId) .then(res => { app.order = res.data app.isLoading = false @@ -271,7 +271,7 @@ handleSubmit() { const app = this const { - orderId + id } = app.order // 判断是否选择了支付方式 if (!app.curPaymentItem) { @@ -284,10 +284,10 @@ // .js console.log("curPaymentItem: ",app.curPaymentItem); if(app.curPaymentItem.method == '余额支付'){ - balance(orderId).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message)) + balance(id).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message)) } if(app.curPaymentItem.method == '支付宝'){ - alipay(orderId).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message)) + alipay(id).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message)) } @@ -334,7 +334,7 @@ payQuery(app.orderId).then(result => { if(result.code == 0) { app.$success('支付成功') - app.$navTo('pages/order/index') + uni.navigateBack() } }) @@ -348,7 +348,7 @@ // }) } if (res.resultCode == "6001") { - app.$navTo('pages/order/index') + uni.navigateBack() } // my.alert({ // content: JSON.stringify(res), @@ -441,7 +441,7 @@ if (lastPage && inArray(lastPage.route, backRoutes)) { uni.navigateBack() } else { - this.$navTo('pages/order/index', {}, 'redirectTo') + uni.navigateBack() } }, 1200) }, diff --git a/pages/checkout/checkout.vue b/pages/checkout/checkout.vue index 2ca6b30..4a69c62 100644 --- a/pages/checkout/checkout.vue +++ b/pages/checkout/checkout.vue @@ -63,10 +63,14 @@ ¥{{ (record.batteryRent + record.batteryDeposit + record.batteryInsurance).toFixed(2) }}元 - - - - + + + + @@ -87,7 +91,7 @@ 电动车保险 {{ record.batteryInsurance }} 元 - + - + - 我已同意并阅读
《服务协议》
《隐私协议》
+ 我已同意并阅读
《服务协议》
《隐私协议》
@@ -106,7 +111,8 @@ - 立即下单 + + - + @@ -31,7 +31,8 @@ - 已完成 + 已完成 待支付 待绑定 进行中 @@ -199,36 +200,6 @@ - - - 下单方式 - - 分期 - - - - - - 下单方式 - - 已租代购 - - - - - 可用天数 - - {{ Math.abs(order.expirationDay) }}天 - - - - - 下单方式 - - 租赁 - - - 所属门店 @@ -247,25 +218,19 @@ {{ equipment.batteryModel }} + 订单金额 ¥{{ order.totalPrice }} 元 - - - + 销售价格 @@ -373,83 +338,8 @@ - - - - 当前期数 - - 首期 - 第 1 期 - - - - 订单金额 - - ¥{{ orderPrice }} - - - - 优惠券抵扣 - - -¥{{ order.couponMoney }} - - - - {{ setting.pointsName }}抵扣 - - -¥{{ order.pointsMoney }} - - - - {{ priceTitle1 }} - - +¥{{ orderPrice1 }} - - - - {{ priceTitle2 }} - - +¥{{ orderPrice2 }} - - - - {{ priceTitle3 }} - - +¥{{ orderPrice3 }} - - - - 付款时间 - {{ order.payTime }} - - - 到期时间 - - {{ order.expirationTime }} - (已逾期 - {{ Math.abs(order.expirationDay) }}天) - - - - - - - - {{ freeTitle }} - - - {{ orderPrice }} - - - - -- 续费订单 -- + + -- 缴费记录 -- - - 确认收货 - + @@ -810,14 +705,14 @@ const { orderId } = app.order - listOrder({ + OrderApi.getOrderPayList({ rentOrderId: orderId, - payStatus: 20 }) .then(res => { console.log(res); - res.data.sort((a,b) => { - return new Date(a.createTime.replace(/-/gi, '/')) - new Date(b.createTime.replace(/-/gi, '/')) + res.data.sort((a, b) => { + return new Date(a.createTime.replace(/-/gi, '/')) - new Date(b.createTime.replace( + /-/gi, '/')) }) app.renewOrderList = res.data; if (res.data.length >= app.equipmentGoods.periods && (this.order.orderSource == 20 || this @@ -943,9 +838,12 @@ // 点击去支付 onPay(orderId) { - this.$navTo('pages/checkout/cashier/index', { - orderId + OrderApi.getOrderPayByOrderId(orderId).then(res => { + this.$navTo('pages/checkout/cashier/index', { + orderId: res.data.id + }) }) + }, // 跳转到订单评价页 @@ -960,7 +858,7 @@ title: '提示', content: '是否退租', success: (result) => { - if(result.confirm) { + if (result.confirm) { const { orderId, equipmentId @@ -980,7 +878,7 @@ } } }) - + }, // 跳转到设备详情页 @@ -990,51 +888,12 @@ }) }, handleHireEquipment(orderId) { - const app = this - const { - order - } = this - const orderNo = createOrderNo() - var time = new Date().getTime() + 60 * 60 * 1000 * 24 - const expirationTime = dateFormat('YYYY-mm-dd HH:MM:SS', new Date(time)) - addOrder({ - orderNo: createOrderNo(), - merchantCode: order.merchantCode, - goodsId: app.goodsId, - totalPrice: app.orderPrice, - orderPrice: app.orderPrice, - payPrice: app.orderPrice, - month: app.month, - expirationTime, - isRenew: 1, - rentOrderId: orderId, - batteryRent: order.batteryRent, - batteryDeposit: order.batteryDeposit, - batteryInsurance: order.batteryInsurance, - orderSource: order.orderSource, - orderSourceId: order.goodsId, - equipmentId: order.equipmentId, - dealerPhone: order.dealerPhone, - comments: '续租订单' + order.orderNo - }).then(res => { - const { - orderId - } = res.data - app.$success("下单成功") - setTimeout(() => { - this.$navTo('pages/checkout/cashier/index', { - orderId - }) - }, 100) + OrderApi.getOrderPayByOrderId(orderId).then(res => { + this.$navTo('pages/checkout/cashier/index', { + orderId: res.data.id + }) }) - // alipayReLet({ - // orderId, - // orderNo, - // tenantId, - // payPrice: 0.01, - // merchantName: app.order.merchantName, - // userId: app.order.userId - // }).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message)) + }, // 订单提交成功后回调 onSubmitCallback(result) { diff --git a/pages/order/index.vue b/pages/order/index.vue index e2b0708..826bee3 100755 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -13,12 +13,14 @@ {{ item.merchantName }} - 已完成 + 已完成 待支付 - 待绑定 - 进行中 + 待绑定 + 进行中 进行中 - + @@ -48,8 +50,10 @@ v-if="item.orderStatus == 30">设备编号:{{ item.equipment.equipmentCode }} 设备名称:{{ item.equipmentGoods.goodsName }} 设备型号:{{ item.equipmentGoods.batteryModel }} - 逾期状态: (已逾期{{ Math.abs(item.expirationDay) }}天) - 逾期状态: 即将过期 + 逾期状态: + (已逾期{{ Math.abs(item.expirationDay) }}天) + 逾期状态: 即将过期 - 绑定设备 + 绑定设备 确认收货 @@ -120,7 +126,7 @@ v-if="item.orderStatus == OrderStatusEnum.COMPLETED.value && item.isComment == 0 && item.receiptStatus != 30"> 我要续费 - + @@ -189,7 +195,8 @@ pageOrder, removeOrder, receiptOrder, - addOrder + addOrder, + getOrderPayByOrderId } from '@/websoft/api/order.js' import { bindEquipment @@ -197,33 +204,37 @@ import { uploadFile } from '@/websoft/api/upload.js' - import { fileUrl } from '@/config.js'; -import { - createOrderNo,dateFormat + import { + fileUrl + } from '@/config.js'; + import { + createOrderNo, + dateFormat } from '@/utils/util.js' // 每页记录数量 const pageSize = 15 // tab栏数据 const tabs = [{ - name: `全部`, - value: 'all' - }, { - name: `待支付`, - value: 'payment' - }, - { - name: `待绑定`, - value: 'delivery' - }, - { - name: `进行中`, - value: 'comment' - }, - { - name: `已完成`, - value: 'refund' - }] + name: `全部`, + value: 'all' + }, { + name: `待支付`, + value: 'payment' + }, + { + name: `待绑定`, + value: 'delivery' + }, + { + name: `进行中`, + value: 'comment' + }, + { + name: `已完成`, + value: 'refund' + } + ] export default { components: { @@ -319,7 +330,7 @@ import { app.curTab = index > -1 ? index : 0 } }, - + /** * 上拉加载的回调 (页面初始化时也会执行一次) * 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 @@ -367,20 +378,21 @@ import { app.where.userId = uni.getStorageSync('userId'); app.where.isRenew = 0; app.where.isApp = true; + app.where.isFreeze = 1; pageOrder(app.where).then(res => { app.list = res.data.list const curPageLen = res.data.list.length const totalSize = res.data.count console.log("totalSize: ", totalSize); app.mescroll.endBySize(curPageLen, totalSize) - - app.list.map((d,index) => { + + app.list.map((d, index) => { const setTime = new Date(d.expirationTime); const nowTime = new Date(); const restSec = setTime.getTime() - nowTime.getTime(); // 剩余天数 - const day = parseInt(restSec / (60*60*24*1000)); - console.log("逾期天数: ",Math.abs(day)); + const day = parseInt(restSec / (60 * 60 * 24 * 1000)); + console.log("逾期天数: ", Math.abs(day)); app.list[index].expirationDay = day }) }) @@ -561,9 +573,14 @@ import { // 点击去支付 onPay(orderId) { - this.$navTo('pages/checkout/cashier/index', { - orderId + + getOrderPayByOrderId(orderId).then(res => { + this.$navTo('pages/checkout/cashier/index', { + orderId: res.data.id + }) }) + + }, // 跳转到订单详情页 @@ -821,8 +838,8 @@ import { margin-top: 30rpx; } } - - .yuqi-text{ + + .yuqi-text { color: #ff0000; } - + \ No newline at end of file diff --git a/pages/user/equipment/index.vue b/pages/user/equipment/index.vue index 7f8bcb1..70dd12f 100644 --- a/pages/user/equipment/index.vue +++ b/pages/user/equipment/index.vue @@ -120,7 +120,8 @@ getEquipmentList() { const app = this EquipmentApi.pageEquipment({ - userId: storage.get("userId") + userId: storage.get("userId"), + equipmentId: app.options.equipmentId }).then(res => { this.list = res.data.list console.log(res); diff --git a/static/order/checkout.png b/static/order/checkout.png new file mode 100644 index 0000000..a66ac2b Binary files /dev/null and b/static/order/checkout.png differ diff --git a/static/zhimamianya.png b/static/zhimamianya.png new file mode 100644 index 0000000..f694e6b Binary files /dev/null and b/static/zhimamianya.png differ diff --git a/uni_modules/uni-data-picker/changelog.md b/uni_modules/uni-data-picker/changelog.md new file mode 100644 index 0000000..1dd79f7 --- /dev/null +++ b/uni_modules/uni-data-picker/changelog.md @@ -0,0 +1,75 @@ +## 1.1.2(2023-04-11) +- 修复 更改 modelValue 报错的 bug +- 修复 v-for 未使用 key 值控制台 warning +## 1.1.1(2023-02-21) +- 修复代码合并时引发 value 属性为空时不渲染数据的问题 +## 1.1.0(2023-02-15) +- 修复 localdata 不支持动态更新的bug +## 1.0.9(2023-02-15) +- 修复 localdata 不支持动态更新的bug +## 1.0.8(2022-09-16) +- 可以使用 uni-scss 控制主题色 +## 1.0.7(2022-07-06) +- 优化 pc端图标位置不正确的问题 +## 1.0.6(2022-07-05) +- 优化 显示样式 +## 1.0.5(2022-07-04) +- 修复 uni-data-picker 在 uni-forms-item 中宽度不正确的bug +## 1.0.4(2022-04-19) +- 修复 字节小程序 本地数据无法选择下一级的Bug +## 1.0.3(2022-02-25) +- 修复 nvue 不支持的 v-show 的 bug +## 1.0.2(2022-02-25) +- 修复 条件编译 nvue 不支持的 css 样式 +## 1.0.1(2021-11-23) +- 修复 由上个版本引发的map、v-model等属性不生效的bug +## 1.0.0(2021-11-19) +- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-data-picker](https://uniapp.dcloud.io/component/uniui/uni-data-picker) +## 0.4.9(2021-10-28) +- 修复 VUE2 v-model 概率无效的 bug +## 0.4.8(2021-10-27) +- 修复 v-model 概率无效的 bug +## 0.4.7(2021-10-25) +- 新增 属性 spaceInfo 服务空间配置 HBuilderX 3.2.11+ +- 修复 树型 uniCloud 数据类型为 int 时报错的 bug +## 0.4.6(2021-10-19) +- 修复 非 VUE3 v-model 为 0 时无法选中的 bug +## 0.4.5(2021-09-26) +- 新增 清除已选项的功能(通过 clearIcon 属性配置是否显示按钮),同时提供 clear 方法以供调用,二者等效 +- 修复 readonly 为 true 时报错的 bug +## 0.4.4(2021-09-26) +- 修复 上一版本造成的 map 属性失效的 bug +- 新增 ellipsis 属性,支持配置 tab 选项长度过长时是否自动省略 +## 0.4.3(2021-09-24) +- 修复 某些情况下级联未触发的 bug +## 0.4.2(2021-09-23) +- 新增 提供 show 和 hide 方法,开发者可以通过 ref 调用 +- 新增 选项内容过长自动添加省略号 +## 0.4.1(2021-09-15) +- 新增 map 属性 字段映射,将 text/value 映射到数据中的其他字段 +## 0.4.0(2021-07-13) +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 0.3.5(2021-06-04) +- 修复 无法加载云端数据的问题 +## 0.3.4(2021-05-28) +- 修复 v-model 无效问题 +- 修复 loaddata 为空数据组时加载时间过长问题 +- 修复 上个版本引出的本地数据无法选择带有 children 的 2 级节点 +## 0.3.3(2021-05-12) +- 新增 组件示例地址 +## 0.3.2(2021-04-22) +- 修复 非树形数据有 where 属性查询报错的问题 +## 0.3.1(2021-04-15) +- 修复 本地数据概率无法回显时问题 +## 0.3.0(2021-04-07) +- 新增 支持云端非树形表结构数据 +- 修复 根节点 parent_field 字段等于 null 时选择界面错乱问题 +## 0.2.0(2021-03-15) +- 修复 nodeclick、popupopened、popupclosed 事件无法触发的问题 +## 0.1.9(2021-03-09) +- 修复 微信小程序某些情况下无法选择的问题 +## 0.1.8(2021-02-05) +- 优化 部分样式在 nvue 上的兼容表现 +## 0.1.7(2021-02-05) +- 调整为 uni_modules 目录规范 diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/keypress.js b/uni_modules/uni-data-picker/components/uni-data-picker/keypress.js new file mode 100644 index 0000000..6ef26a2 --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-picker/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + this.$once('hook:beforeDestroy', () => { + document.removeEventListener('keyup', listener) + }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue new file mode 100644 index 0000000..179a4e0 --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue @@ -0,0 +1,551 @@ + + + + + diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js new file mode 100644 index 0000000..cfae22a --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js @@ -0,0 +1,622 @@ +export default { + props: { + localdata: { + type: [Array, Object], + default () { + return [] + } + }, + spaceInfo: { + type: Object, + default () { + return {} + } + }, + collection: { + type: String, + default: '' + }, + action: { + type: String, + default: '' + }, + field: { + type: String, + default: '' + }, + orderby: { + type: String, + default: '' + }, + where: { + type: [String, Object], + default: '' + }, + pageData: { + type: String, + default: 'add' + }, + pageCurrent: { + type: Number, + default: 1 + }, + pageSize: { + type: Number, + default: 500 + }, + getcount: { + type: [Boolean, String], + default: false + }, + getone: { + type: [Boolean, String], + default: false + }, + gettree: { + type: [Boolean, String], + default: false + }, + manual: { + type: Boolean, + default: false + }, + value: { + type: [Array, String, Number], + default () { + return [] + } + }, + modelValue: { + type: [Array, String, Number], + default () { + return [] + } + }, + preload: { + type: Boolean, + default: false + }, + stepSearh: { + type: Boolean, + default: true + }, + selfField: { + type: String, + default: '' + }, + parentField: { + type: String, + default: '' + }, + multiple: { + type: Boolean, + default: false + }, + map: { + type: Object, + default () { + return { + text: "text", + value: "value" + } + } + } + }, + data() { + return { + loading: false, + errorMessage: '', + loadMore: { + contentdown: '', + contentrefresh: '', + contentnomore: '' + }, + dataList: [], + selected: [], + selectedIndex: 0, + page: { + current: this.pageCurrent, + size: this.pageSize, + count: 0 + } + } + }, + computed: { + isLocalData() { + return !this.collection.length; + }, + isCloudData() { + return this.collection.length > 0; + }, + isCloudDataList() { + return (this.isCloudData && (!this.parentField && !this.selfField)); + }, + isCloudDataTree() { + return (this.isCloudData && this.parentField && this.selfField); + }, + dataValue() { + let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || + this.modelValue !== undefined); + return isModelValue ? this.modelValue : this.value; + }, + hasValue() { + if (typeof this.dataValue === 'number') { + return true + } + return (this.dataValue != null) && (this.dataValue.length > 0) + } + }, + created() { + this.$watch(() => { + var al = []; + ['pageCurrent', + 'pageSize', + 'spaceInfo', + 'value', + 'modelValue', + 'localdata', + 'collection', + 'action', + 'field', + 'orderby', + 'where', + 'getont', + 'getcount', + 'gettree' + ].forEach(key => { + al.push(this[key]) + }); + return al + }, (newValue, oldValue) => { + let needReset = false + for (let i = 2; i < newValue.length; i++) { + if (newValue[i] != oldValue[i]) { + needReset = true + break + } + } + if (newValue[0] != oldValue[0]) { + this.page.current = this.pageCurrent + } + this.page.size = this.pageSize + + this.onPropsChange() + }) + this._treeData = [] + }, + methods: { + onPropsChange() { + this._treeData = []; + }, + + // 填充 pickview 数据 + async loadData() { + if (this.isLocalData) { + this.loadLocalData(); + } else if (this.isCloudDataList) { + this.loadCloudDataList(); + } else if (this.isCloudDataTree) { + this.loadCloudDataTree(); + } + }, + + // 加载本地数据 + async loadLocalData() { + this._treeData = []; + this._extractTree(this.localdata, this._treeData); + + let inputValue = this.dataValue; + if (inputValue === undefined) { + return; + } + + if (Array.isArray(inputValue)) { + inputValue = inputValue[inputValue.length - 1]; + if (typeof inputValue === 'object' && inputValue[this.map.value]) { + inputValue = inputValue[this.map.value]; + } + } + + this.selected = this._findNodePath(inputValue, this.localdata); + }, + + // 加载 Cloud 数据 (单列) + async loadCloudDataList() { + if (this.loading) { + return; + } + this.loading = true; + + try { + let response = await this.getCommand(); + let responseData = response.result.data; + + this._treeData = responseData; + + this._updateBindData(); + this._updateSelected(); + + this.onDataChange(); + } catch (e) { + this.errorMessage = e; + } finally { + this.loading = false; + } + }, + + // 加载 Cloud 数据 (树形) + async loadCloudDataTree() { + if (this.loading) { + return; + } + this.loading = true; + + try { + let commandOptions = { + field: this._cloudDataPostField(), + where: this._cloudDataTreeWhere() + }; + if (this.gettree) { + commandOptions.startwith = `${this.selfField}=='${this.dataValue}'`; + } + + let response = await this.getCommand(commandOptions); + let responseData = response.result.data; + + this._treeData = responseData; + this._updateBindData(); + this._updateSelected(); + + this.onDataChange(); + } catch (e) { + this.errorMessage = e; + } finally { + this.loading = false; + } + }, + + // 加载 Cloud 数据 (节点) + async loadCloudDataNode(callback) { + if (this.loading) { + return; + } + this.loading = true; + + try { + let commandOptions = { + field: this._cloudDataPostField(), + where: this._cloudDataNodeWhere() + }; + + let response = await this.getCommand(commandOptions); + let responseData = response.result.data; + + callback(responseData); + } catch (e) { + this.errorMessage = e; + } finally { + this.loading = false; + } + }, + + // 回显 Cloud 数据 + getCloudDataValue() { + if (this.isCloudDataList) { + return this.getCloudDataListValue(); + } + + if (this.isCloudDataTree) { + return this.getCloudDataTreeValue(); + } + }, + + // 回显 Cloud 数据 (单列) + getCloudDataListValue() { + // 根据 field's as value标识匹配 where 条件 + let where = []; + let whereField = this._getForeignKeyByField(); + if (whereField) { + where.push(`${whereField} == '${this.dataValue}'`) + } + + where = where.join(' || '); + + if (this.where) { + where = `(${this.where}) && (${where})` + } + + return this.getCommand({ + field: this._cloudDataPostField(), + where + }).then((res) => { + this.selected = res.result.data; + return res.result.data; + }); + }, + + // 回显 Cloud 数据 (树形) + getCloudDataTreeValue() { + return this.getCommand({ + field: this._cloudDataPostField(), + getTreePath: { + startWith: `${this.selfField}=='${this.dataValue}'` + } + }).then((res) => { + let treePath = []; + this._extractTreePath(res.result.data, treePath); + this.selected = treePath; + return treePath; + }); + }, + + getCommand(options = {}) { + /* eslint-disable no-undef */ + let db = uniCloud.database(this.spaceInfo) + + const action = options.action || this.action + if (action) { + db = db.action(action) + } + + const collection = options.collection || this.collection + db = db.collection(collection) + + const where = options.where || this.where + if (!(!where || !Object.keys(where).length)) { + db = db.where(where) + } + + const field = options.field || this.field + if (field) { + db = db.field(field) + } + + const orderby = options.orderby || this.orderby + if (orderby) { + db = db.orderBy(orderby) + } + + const current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current + const size = options.pageSize !== undefined ? options.pageSize : this.page.size + const getCount = options.getcount !== undefined ? options.getcount : this.getcount + const getTree = options.gettree !== undefined ? options.gettree : this.gettree + + const getOptions = { + getCount, + getTree + } + if (options.getTreePath) { + getOptions.getTreePath = options.getTreePath + } + + db = db.skip(size * (current - 1)).limit(size).get(getOptions) + + return db + }, + + _cloudDataPostField() { + let fields = [this.field]; + if (this.parentField) { + fields.push(`${this.parentField} as parent_value`); + } + return fields.join(','); + }, + + _cloudDataTreeWhere() { + let result = [] + let selected = this.selected + let parentField = this.parentField + if (parentField) { + result.push(`${parentField} == null || ${parentField} == ""`) + } + if (selected.length) { + for (var i = 0; i < selected.length - 1; i++) { + result.push(`${parentField} == '${selected[i].value}'`) + } + } + + let where = [] + if (this.where) { + where.push(`(${this.where})`) + } + + if (result.length) { + where.push(`(${result.join(' || ')})`) + } + + return where.join(' && ') + }, + + _cloudDataNodeWhere() { + let where = [] + let selected = this.selected; + if (selected.length) { + where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`); + } + + where = where.join(' || '); + + if (this.where) { + return `(${this.where}) && (${where})` + } + + return where + }, + + _getWhereByForeignKey() { + let result = [] + let whereField = this._getForeignKeyByField(); + if (whereField) { + result.push(`${whereField} == '${this.dataValue}'`) + } + + if (this.where) { + return `(${this.where}) && (${result.join(' || ')})` + } + + return result.join(' || ') + }, + + _getForeignKeyByField() { + let fields = this.field.split(','); + let whereField = null; + for (let i = 0; i < fields.length; i++) { + const items = fields[i].split('as'); + if (items.length < 2) { + continue; + } + if (items[1].trim() === 'value') { + whereField = items[0].trim(); + break; + } + } + return whereField; + }, + + _updateBindData(node) { + const { + dataList, + hasNodes + } = this._filterData(this._treeData, this.selected) + + let isleaf = this._stepSearh === false && !hasNodes + + if (node) { + node.isleaf = isleaf + } + + this.dataList = dataList + this.selectedIndex = dataList.length - 1 + + if (!isleaf && this.selected.length < dataList.length) { + this.selected.push({ + value: null, + text: "请选择" + }) + } + + return { + isleaf, + hasNodes + } + }, + + _updateSelected() { + let dl = this.dataList + let sl = this.selected + let textField = this.map.text + let valueField = this.map.value + for (let i = 0; i < sl.length; i++) { + let value = sl[i].value + let dl2 = dl[i] + for (let j = 0; j < dl2.length; j++) { + let item2 = dl2[j] + if (item2[valueField] === value) { + sl[i].text = item2[textField] + break + } + } + } + }, + + _filterData(data, paths) { + let dataList = [] + let hasNodes = true + + dataList.push(data.filter((item) => { + return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '') + })) + for (let i = 0; i < paths.length; i++) { + let value = paths[i].value + let nodes = data.filter((item) => { + return item.parent_value === value + }) + + if (nodes.length) { + dataList.push(nodes) + } else { + hasNodes = false + } + } + + return { + dataList, + hasNodes + } + }, + + _extractTree(nodes, result, parent_value) { + let list = result || [] + let valueField = this.map.value + for (let i = 0; i < nodes.length; i++) { + let node = nodes[i] + + let child = {} + for (let key in node) { + if (key !== 'children') { + child[key] = node[key] + } + } + if (parent_value !== null && parent_value !== undefined && parent_value !== '') { + child.parent_value = parent_value + } + result.push(child) + + let children = node.children + if (children) { + this._extractTree(children, result, node[valueField]) + } + } + }, + + _extractTreePath(nodes, result) { + let list = result || [] + for (let i = 0; i < nodes.length; i++) { + let node = nodes[i] + + let child = {} + for (let key in node) { + if (key !== 'children') { + child[key] = node[key] + } + } + result.push(child) + + let children = node.children + if (children) { + this._extractTreePath(children, result) + } + } + }, + + _findNodePath(key, nodes, path = []) { + let textField = this.map.text + let valueField = this.map.value + for (let i = 0; i < nodes.length; i++) { + let node = nodes[i] + let children = node.children + let text = node[textField] + let value = node[valueField] + + path.push({ + value, + text + }) + + if (value === key) { + return path + } + + if (children) { + const p = this._findNodePath(key, children, path) + if (p.length) { + return p + } + } + + path.pop() + } + return [] + } + } +} diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue new file mode 100644 index 0000000..6ebced9 --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue @@ -0,0 +1,323 @@ + + + + + diff --git a/uni_modules/uni-data-picker/package.json b/uni_modules/uni-data-picker/package.json new file mode 100644 index 0000000..038f9ce --- /dev/null +++ b/uni_modules/uni-data-picker/package.json @@ -0,0 +1,90 @@ +{ + "id": "uni-data-picker", + "displayName": "uni-data-picker 数据驱动的picker选择器", + "version": "1.1.2", + "description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景", + "keywords": [ + "uni-ui", + "uniui", + "picker", + "级联", + "省市区", + "" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-load-more", + "uni-icons", + "uni-scss" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-data-picker/readme.md b/uni_modules/uni-data-picker/readme.md new file mode 100644 index 0000000..6cda224 --- /dev/null +++ b/uni_modules/uni-data-picker/readme.md @@ -0,0 +1,22 @@ +## DataPicker 级联选择 +> **组件名:uni-data-picker** +> 代码块: `uDataPicker` +> 关联组件:`uni-data-pickerview`、`uni-load-more`。 + + +`` 是一个选择类[datacom组件](https://uniapp.dcloud.net.cn/component/datacom)。 + +支持单列、和多列级联选择。列数没有限制,如果屏幕显示不全,顶部tab区域会左右滚动。 + +候选数据支持一次性加载完毕,也支持懒加载,比如示例图中,选择了“北京”后,动态加载北京的区县数据。 + +`` 组件尤其适用于地址选择、分类选择等选择类。 + +`` 支持本地数据、云端静态数据(json),uniCloud云数据库数据。 + +`` 可以通过JQL直连uniCloud云数据库,配套[DB Schema](https://uniapp.dcloud.net.cn/uniCloud/schema),可在schema2code中自动生成前端页面,还支持服务器端校验。 + +在uniCloud数据表中新建表“uni-id-address”和“opendb-city-china”,这2个表的schema自带foreignKey关联。在“uni-id-address”表的表结构页面使用schema2code生成前端页面,会自动生成地址管理的维护页面,自动从“opendb-city-china”表包含的中国所有省市区信息里选择地址。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-picker) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-load-more/changelog.md b/uni_modules/uni-load-more/changelog.md new file mode 100644 index 0000000..8f03f1d --- /dev/null +++ b/uni_modules/uni-load-more/changelog.md @@ -0,0 +1,19 @@ +## 1.3.3(2022-01-20) +- 新增 showText属性 ,是否显示文本 +## 1.3.2(2022-01-19) +- 修复 nvue 平台下不显示文本的bug +## 1.3.1(2022-01-19) +- 修复 微信小程序平台样式选择器报警告的问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-load-more](https://uniapp.dcloud.io/component/uniui/uni-load-more) +## 1.2.1(2021-08-24) +- 新增 支持国际化 +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.8(2021-05-12) +- 新增 组件示例地址 +## 1.1.7(2021-03-30) +- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug +## 1.1.6(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json new file mode 100644 index 0000000..a4f14a5 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "Pull up to show more", + "uni-load-more.contentrefresh": "loading...", + "uni-load-more.contentnomore": "No more data" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json new file mode 100644 index 0000000..f15d510 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉显示更多", + "uni-load-more.contentrefresh": "正在加载...", + "uni-load-more.contentnomore": "没有更多数据了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json new file mode 100644 index 0000000..a255c6d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉顯示更多", + "uni-load-more.contentrefresh": "正在加載...", + "uni-load-more.contentnomore": "沒有更多數據了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue new file mode 100644 index 0000000..e5eff4d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue @@ -0,0 +1,399 @@ + + + + + diff --git a/uni_modules/uni-load-more/package.json b/uni_modules/uni-load-more/package.json new file mode 100644 index 0000000..2fa6f04 --- /dev/null +++ b/uni_modules/uni-load-more/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-load-more", + "displayName": "uni-load-more 加载更多", + "version": "1.3.3", + "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", + "keywords": [ + "uni-ui", + "uniui", + "加载更多", + "load-more" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-load-more/readme.md b/uni_modules/uni-load-more/readme.md new file mode 100644 index 0000000..54dc1fa --- /dev/null +++ b/uni_modules/uni-load-more/readme.md @@ -0,0 +1,14 @@ + + +### LoadMore 加载更多 +> **组件名:uni-load-more** +> 代码块: `uLoadMore` + + +用于列表中,做滚动加载使用,展示 loading 的各种状态。 + + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-load-more) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/websoft/api/order.js b/websoft/api/order.js index 8d9e701..f8ba473 100644 --- a/websoft/api/order.js +++ b/websoft/api/order.js @@ -8,6 +8,9 @@ export const listOrder = (params) => http.get('/shop/order', {params}) // 查询订单 export const getOrder = (orderId) => http.get('/shop/order/' + orderId) +export const getOrderPay = (id) => http.get('/shop/order-pay/' + id) +export const getOrderPayByOrderId = (orderId) => http.get('/shop/order-pay/getByOrderId/' + orderId) +export const getOrderPayList = (params) => http.get('/shop/order-pay/', {params}) // 添加订单 export const addOrder = (data) => http.post('/shop/order', data) @@ -20,6 +23,9 @@ export const removeOrder = (id) => http.get('/open/order/remove/' + id) export const setPayStatus = (data) => http.post('/shop/order/setPayStatus', data) +export const freeze = (data) => http.get('/shop/order/freeze', {}) +export const checkFreeze = (orderId) => http.post('/shop/freeze-order/checkFreeze/' + orderId, {}) + export default { pageOrder, listOrder, @@ -27,5 +33,10 @@ export default { addOrder, receiptOrder, removeOrder, - setPayStatus + setPayStatus, + freeze, + checkFreeze, + getOrderPay, + getOrderPayByOrderId, + getOrderPayList }