diff --git a/api/mall/discount.js b/api/mall/discount.js new file mode 100644 index 0000000..f39be0f --- /dev/null +++ b/api/mall/discount.js @@ -0,0 +1,91 @@ +import { + request +} from "@/utils/request"; + +export default { + + SalesDiscounts: { + + List(data) { + return request({ + url: "/shop/SalesDiscounts/List", + method: "GET", + data, + type: 'mall' + }); + }, + GetItem(data) { + return request({ + url: "/shop/SalesDiscounts/GetItem", + method: "GET", + data, + type: 'mall' + }); + }, + Create(data) { + return request({ + url: "/shop/SalesDiscounts/Create", + method: "POST", + data, + type: 'mall' + }); + }, + }, + + SalesFullDiscounts: { + + List(data) { + return request({ + url: "/shop/SalesFullDiscounts/List", + method: "GET", + data, + type: 'mall' + }); + }, + GetItem(data) { + return request({ + url: "/shop/SalesFullDiscounts/GetItem", + method: "GET", + data, + type: 'mall' + }); + }, + Create(data) { + return request({ + url: "/shop/SalesFullDiscounts/Create", + method: "POST", + data, + type: 'mall' + }); + }, + }, + + SalesFullSetRedution: { + + List(data) { + return request({ + url: "/shop/SalesFullSetRedution/List", + method: "GET", + data, + type: 'mall' + }); + }, + GetItem(data) { + return request({ + url: "/shop/SalesFullSetRedution/GetItem", + method: "GET", + data, + type: 'mall' + }); + }, + Create(data) { + return request({ + url: "/shop/SalesFullSetRedution/Create", + method: "POST", + data, + type: 'mall' + }); + }, + } + +}; \ No newline at end of file diff --git a/api/modules/system.js b/api/modules/system.js index 2342c37..ed3aa2f 100644 --- a/api/modules/system.js +++ b/api/modules/system.js @@ -37,4 +37,14 @@ export default { }, + + getSetting(data) { + return request({ + url: "/admin/common/getSetting", + method: "GET", + data, + }) + }, + + }; \ No newline at end of file diff --git a/api/store/pointsGoods.js b/api/store/pointsGoods.js new file mode 100644 index 0000000..ecc8def --- /dev/null +++ b/api/store/pointsGoods.js @@ -0,0 +1,135 @@ +import { + request +} from "@/utils/request"; + +export default { + + PointsList(data) { + return request({ + url: "/admin/PointsGoods/PointsList", + method: "POST", + data, + type: 'store' + }) + }, + + PointsSave(data) { + return request({ + url: "/admin/PointsGoods/PointsSave", + method: "POST", + data, + type: 'store' + }) + }, + + classifyList(data) { + return request({ + url: "/admin/PointsGoods/classifyList", + method: "POST", + data, + type: 'store' + }) + }, + + ClassifySave(data) { + return request({ + url: "/admin/PointsGoods/ClassifySave", + method: "POST", + data, + type: 'store' + }) + }, + + + list(data) { + return request({ + url: "/admin/PointsGoods/goodsList", + method: "POST", + data, + type: 'store' + }); + }, + + goodsItem(data) { + return request({ + url: "/admin/PointsGoods/goodsItem", + method: "POST", + data, + type: 'store' + }); + }, + + + goodsEdit(data) { + return request({ + url: "/admin/PointsGoods/goodsEdit", + method: "POST", + data, + type: 'store' + }); + }, + + goodsDel(data) { + return request({ + url: "/admin/PointsGoods/goodsDel", + method: "POST", + data, + type: 'store' + }); + }, + + + orderList(data) { + return request({ + url: "/admin/PointsOrder/orderList", + method: "POST", + data, + type: 'store' + }); + }, + + orderSend(data) { + return request({ + url: "/admin/PointsOrder/orderSend", + method: "POST", + data, + type: 'store' + }); + }, + + GetExpressList(data) { + return request({ + url: "/admin/PointsOrder/GetExpressList", + method: "POST", + data, + type: 'store' + }); + }, + + printOrder(data) { + return request({ + url: "/admin/PointsOrder/printOrder", + method: "POST", + data, + type: 'store' + }); + }, + + updateNotes(data) { + return request({ + url: "/admin/PointsOrder/updateNotes", + method: "POST", + data, + type: 'store' + }); + }, + + confirmCancel(data) { + return request({ + url: "/admin/PointsOrder/confirmCancel", + method: "POST", + data, + type: 'store' + }); + }, +}; \ No newline at end of file diff --git a/api/store/recharge.js b/api/store/recharge.js index 46c1e6a..1708e27 100644 --- a/api/store/recharge.js +++ b/api/store/recharge.js @@ -30,6 +30,16 @@ export default { }); }, + + del(data) { + return request({ + url: "/admin/recharge/del", + method: "GET", + data, + type: 'store' + }); + }, + rechargeSet: { list(data) { return request({ diff --git a/mall/components/myTabbar/index.vue b/mall/components/myTabbar/index.vue index 1c0b6e7..f6530ac 100644 --- a/mall/components/myTabbar/index.vue +++ b/mall/components/myTabbar/index.vue @@ -2,6 +2,10 @@ + + + diff --git a/mall/discount/discount/edit.vue b/mall/discount/discount/edit.vue new file mode 100644 index 0000000..f5a0737 --- /dev/null +++ b/mall/discount/discount/edit.vue @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + 如商品单价100,折扣比例40 (4折),仅需付40元 + + + + + + + + + + + + + + + + + + + + + + 保存 + + + + + + + + + + diff --git a/mall/discount/discount/index.vue b/mall/discount/discount/index.vue new file mode 100644 index 0000000..d235af2 --- /dev/null +++ b/mall/discount/discount/index.vue @@ -0,0 +1,247 @@ + + + + + + + + + + + + {{ searchType }} + + + + + + + + + 新增折扣 + + + + + + + + + + + + + + + + + + + ID:{{ item?.id }} + + + + + + + + 折扣名称:{{ item.name }} + 折扣:{{ item.discount || 0 }} + + + + + + 时间: + {{ utils.dateFormat(item.start_time * 1000) }} - {{ + utils.dateFormat(item.end_time * 1000) }} + + + + + + + + + + + + {{ ["关闭", "开启", "已取消"][item.status] }} + + + + + 编辑 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mall/discount/full_discount/edit.vue b/mall/discount/full_discount/edit.vue new file mode 100644 index 0000000..028268c --- /dev/null +++ b/mall/discount/full_discount/edit.vue @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + 如商品单价100,折扣比例40 (4折),仅需付40元 + + + + + + + + + + + + 保存 + + + + + + + + + + diff --git a/mall/discount/full_discount/index.vue b/mall/discount/full_discount/index.vue new file mode 100644 index 0000000..a101d63 --- /dev/null +++ b/mall/discount/full_discount/index.vue @@ -0,0 +1,237 @@ + + + + + + + + + + + + {{ searchType }} + + + + + + + + + 新增折扣 + + + + + + + + + + + + + + + + + + + ID:{{ item?.id }} + + + + + + + + 折扣名称:{{ item.name }} + 折扣:{{ item.fullDiscount || 0 }} + + + + + + + + + + {{ ["关闭", "开启", "已取消"][item.status] }} + + + + + 编辑 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mall/discount/full_set_redution/edit.vue b/mall/discount/full_set_redution/edit.vue new file mode 100644 index 0000000..0c899e6 --- /dev/null +++ b/mall/discount/full_set_redution/edit.vue @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 如商品单价100,折扣比例40 (4折),仅需付40元 + + + + + + + + + + + + + + + + + + + + + + 保存 + + + + + + + + + + diff --git a/mall/discount/full_set_redution/index.vue b/mall/discount/full_set_redution/index.vue new file mode 100644 index 0000000..30433df --- /dev/null +++ b/mall/discount/full_set_redution/index.vue @@ -0,0 +1,247 @@ + + + + + + + + + + + + {{ searchType }} + + + + + + + + + 新增折扣 + + + + + + + + + + + + + + + + + + + ID:{{ item?.id }} + + + + + + + + 折扣名称:{{ item.name }} + 满减金额:{{ item.full_price || 0 }} + 折扣:{{ item.discount || 0 }} + + + + + 时间: + {{ utils.dateFormat(item.start_time * 1000) }} - {{ + utils.dateFormat(item.end_time * 1000) }} + + + + + + + + + + + + {{ ["关闭", "开启", "已取消"][item.status] }} + + + + + 编辑 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mall/function/index.vue b/mall/function/index.vue new file mode 100644 index 0000000..92ac2f4 --- /dev/null +++ b/mall/function/index.vue @@ -0,0 +1,143 @@ + + + + + + + + + + + 基础功能 + + + + + + + 商品分类 + + + + 商品管理 + + + + + + + + + + + + + + 订单管理 + + + + + + 普通订单 + + + + 自提订单 + + + + 当面付订单 + + + + + + + + + + + + + + 折扣管理 + + + + + + 限时折扣 + + + + 梯度折扣 + + + + 满额立减 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mall/index/index.vue b/mall/index/index.vue index 0c6a6ba..43321de 100644 --- a/mall/index/index.vue +++ b/mall/index/index.vue @@ -49,7 +49,7 @@ - 自提订单 @@ -72,7 +72,7 @@ - + --> - - - - - - - + --> - - + - - - - 更多功能 - - - - - 优惠券 - - - - 核销记录 - - - - 会员管理 - - - - 会员等级 - + + + + + + + + + + + + + 积分商城 + + + + + + 积分设置 + + + + + 商品分类 + + + + + 商品管理 + + + + + 订单管理 + + + + + + + + + + + + + + + 提现管理 + + + + + + 提现设置 + + + + + 分销提现 + + + + + + + + + + + + + + + + 更多功能 + + + + + + 充值管理 + + + + + 优惠券 + + + + + 核销记录 + + + + - - + + + diff --git a/store/index/index.vue b/store/index/index.vue index 52407dd..161ade4 100644 --- a/store/index/index.vue +++ b/store/index/index.vue @@ -1,7 +1,6 @@ - @@ -20,7 +19,54 @@ - + + + + + + + 猜您想用 ? + + + + + + {{ item.name }} + + + + + + + + 会员管理 + + + + + 商品管理 + + + + + 订单管理 + + + + + + + + + @@ -147,6 +193,7 @@ import myTabbar from "../components/myTabbar/index.vue"; import bar from "../components/bar/bar.vue"; import kevyloading from "@/components/kevy-loading/kevy-loading"; + /** * @type {Ref} * 控制页面加载状态的 Ref @@ -268,6 +315,7 @@ const getOrderGood = (e) => { // 初始化调用获取订单商品数据 getOrderGood({ index: 0 }); +const recommend = utils.recommendPage() diff --git a/store/points/cat.vue b/store/points/cat.vue new file mode 100644 index 0000000..92251d4 --- /dev/null +++ b/store/points/cat.vue @@ -0,0 +1,130 @@ + + + + + + + 新增 + + + {{ cat.name }} + + + + + + + + + + + + + \ No newline at end of file diff --git a/store/points/catEdit.vue b/store/points/catEdit.vue new file mode 100644 index 0000000..afbf051 --- /dev/null +++ b/store/points/catEdit.vue @@ -0,0 +1,87 @@ + + + + + 上级分类: ({{ parent.name }}) + + + + + + + + + + + + + + + + + + + + + + + + + + + 保存 + + + + + + + + + \ No newline at end of file diff --git a/store/points/goods/components/skuEdit.vue b/store/points/goods/components/skuEdit.vue new file mode 100644 index 0000000..8510cbd --- /dev/null +++ b/store/points/goods/components/skuEdit.vue @@ -0,0 +1,374 @@ + + + + + + + + + {{ item.name }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 规格设置 + + + + + 添加规格组 + + + + + + 规格组 + + + + + {{ + item.name }} + + + + + 添加规格 + + + 规格: + + {{ value.name + }} + + + + + + + + + + + + + + + diff --git a/store/points/goods/components/uni-data-picker/changelog.md b/store/points/goods/components/uni-data-picker/changelog.md new file mode 100644 index 0000000..486eedc --- /dev/null +++ b/store/points/goods/components/uni-data-picker/changelog.md @@ -0,0 +1,56 @@ +## 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/store/points/goods/components/uni-data-picker/components/uni-data-picker/keypress.js b/store/points/goods/components/uni-data-picker/components/uni-data-picker/keypress.js new file mode 100644 index 0000000..6ef26a2 --- /dev/null +++ b/store/points/goods/components/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/store/points/goods/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue b/store/points/goods/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue new file mode 100644 index 0000000..6014efe --- /dev/null +++ b/store/points/goods/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue @@ -0,0 +1,598 @@ + + + + + + {{ + errorMessage + }} + + + + + + + {{ item.text }}{{ split }} + + + + {{ + placeholder + }} + + + + + + + + + + + + + + + + {{ popupTitle }} + + + + + + + + + + + + + + + diff --git a/store/points/goods/components/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js b/store/points/goods/components/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js new file mode 100644 index 0000000..c12fd54 --- /dev/null +++ b/store/points/goods/components/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js @@ -0,0 +1,563 @@ +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: 20 + }, + 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 + }, + postField() { + let fields = [this.field]; + if (this.parentField) { + fields.push(`${this.parentField} as parent_value`); + } + return fields.join(','); + }, + 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 = [] + }, + 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 + }, + getNodeData(callback) { + if (this.loading) { + return + } + this.loading = true + this.getCommand({ + field: this.postField, + where: this._pathWhere() + }).then((res) => { + this.loading = false + this.selected = res.result.data + callback && callback() + }).catch((err) => { + this.loading = false + this.errorMessage = err + }) + }, + getTreePath(callback) { + if (this.loading) { + return + } + this.loading = true + + this.getCommand({ + field: this.postField, + getTreePath: { + startWith: `${this.selfField}=='${this.dataValue}'` + } + }).then((res) => { + this.loading = false + let treePath = [] + this._extractTreePath(res.result.data, treePath) + this.selected = treePath + callback && callback() + }).catch((err) => { + this.loading = false + this.errorMessage = err + }) + }, + loadData() { + if (this.isLocaldata) { + this._processLocalData() + return + } + + if (this.dataValue != null) { + this._loadNodeData((data) => { + this._treeData = data + this._updateBindData() + this._updateSelected() + }) + return + } + + if (this.stepSearh) { + this._loadNodeData((data) => { + this._treeData = data + this._updateBindData() + }) + } else { + this._loadAllData((data) => { + this._treeData = [] + this._extractTree(data, this._treeData, null) + this._updateBindData() + }) + } + }, + _loadAllData(callback) { + if (this.loading) { + return + } + this.loading = true + + this.getCommand({ + field: this.postField, + gettree: true, + startwith: `${this.selfField}=='${this.dataValue}'` + }).then((res) => { + this.loading = false + callback(res.result.data) + this.onDataChange() + }).catch((err) => { + this.loading = false + this.errorMessage = err + }) + }, + _loadNodeData(callback, pw) { + if (this.loading) { + return + } + this.loading = true + + this.getCommand({ + field: this.postField, + where: pw || this._postWhere(), + pageSize: 500 + }).then((res) => { + this.loading = false + callback(res.result.data) + this.onDataChange() + }).catch((err) => { + this.loading = false + this.errorMessage = err + }) + }, + _pathWhere() { + let result = [] + let where_field = this._getParentNameByField(); + if (where_field) { + result.push(`${where_field} == '${this.dataValue}'`) + } + + if (this.where) { + return `(${this.where}) && (${result.join(' || ')})` + } + + return result.join(' || ') + }, + _postWhere() { + 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(' && ') + }, + _nodeWhere() { + let result = [] + let selected = this.selected + if (selected.length) { + result.push(`${this.parentField} == '${selected[selected.length - 1].value}'`) + } + + if (this.where) { + return `(${this.where}) && (${result.join(' || ')})` + } + + return result.join(' || ') + }, + _getParentNameByField() { + const fields = this.field.split(','); + let where_field = 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') { + where_field = items[0].trim(); + break; + } + } + return where_field + }, + _isTreeView() { + return (this.parentField && this.selfField) + }, + _updateSelected() { + var dl = this.dataList + var sl = this.selected + let textField = this.map.text + let valueField = this.map.value + for (var i = 0; i < sl.length; i++) { + var value = sl[i].value + var dl2 = dl[i] + for (var j = 0; j < dl2.length; j++) { + var item2 = dl2[j] + if (item2[valueField] === value) { + sl[i].text = item2[textField] + break + } + } + } + }, + _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 + } + }, + _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++) { + var value = paths[i].value + var 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 [] + }, + _processLocalData() { + this._treeData = [] + this._extractTree(this.localdata, this._treeData) + + var 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) + } + } +} diff --git a/store/points/goods/components/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue b/store/points/goods/components/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue new file mode 100644 index 0000000..d4882f1 --- /dev/null +++ b/store/points/goods/components/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue @@ -0,0 +1,364 @@ + + + + + + + {{ item.text }} + + + + + + + + + {{ + item[map.text] + }} + + + + + + + + + + {{ errorMessage }} + + + + + + + diff --git a/store/points/goods/components/uni-data-picker/package.json b/store/points/goods/components/uni-data-picker/package.json new file mode 100644 index 0000000..d4925ef --- /dev/null +++ b/store/points/goods/components/uni-data-picker/package.json @@ -0,0 +1,92 @@ +{ + "id": "uni-data-picker", + "displayName": "uni-data-picker 数据驱动的picker选择器", + "version": "1.0.3", + "description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景", + "keywords": [ + "uni-ui", + "uniui", + "picker", + "级联", + "省市区", + "" +], + "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-load-more", + "uni-icons", + "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/store/points/goods/components/uni-data-picker/readme.md b/store/points/goods/components/uni-data-picker/readme.md new file mode 100644 index 0000000..6cda224 --- /dev/null +++ b/store/points/goods/components/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/store/points/goods/edit.vue b/store/points/goods/edit.vue new file mode 100644 index 0000000..f833ec7 --- /dev/null +++ b/store/points/goods/edit.vue @@ -0,0 +1,439 @@ + + + + + + + + + + + 缩略图 + + + + + + + + + 商品主图 + + + + + + + + + + + 商品名称 + + + + + + + + + + 商品积分 + + + + + + + + + 商品分类 + + + + + + + {{ cat.name }} + + + + + + + + + + + + + + + 商品重量 + + + 千克 + + + + + + + + + + 商品状态 + + + + + + + + + 规格 + + + 单规格 + 多规格 + + + + + + + + + + + + 保存 + + + + + + + + diff --git a/store/points/goods/index.vue b/store/points/goods/index.vue new file mode 100644 index 0000000..3535aaa --- /dev/null +++ b/store/points/goods/index.vue @@ -0,0 +1,254 @@ + + + + + + + + {{ searchType }} + + + + + + + + + + + + + + + + + + + + 库存:{{ item.stock_num || 0 }} + + + 商品库存不足 + + + + + + + {{ item.name }} + ¥{{ item.price_min }} + + + + + + + 编辑 + 删除 + + + + + + + + + + 分类 + 发布商品 + + + + + + + + + + + + diff --git a/store/points/order.vue b/store/points/order.vue new file mode 100644 index 0000000..6d876a4 --- /dev/null +++ b/store/points/order.vue @@ -0,0 +1,515 @@ + + + + + + + + + + + 快递发货 + 无需物流 + + + + + + + + + {{ item.label }} + + + + + + + + + + + + + + + + + + + + + {{ searchType }} + + + + + + + + + 售后订单 + + + + { + params.status = e.index; + search({ value: params.keywords }) + }" v-model="params.status"> + + + + + + + + + + + + + + + {{ item.shop.name }} + 商城自营 + ({{ status[item.status + 1].content }}) + + + + 单号:{{ item.order_no }} + + + + + + + + {{ subItem.goods_name }} + + 小计: {{ subItem.price }} 元 + ({{ + subItem.num }}) 件 - + ({{ + subItem.points }}) 积分 + + + + + {{ sku.group_name }}:{{ sku.name }} + + + + + + + + 下单用户:{{ item.user.nickname }} + + ( 会员ID:{{ item.user.id }} ) + + + + 收货人:{{ item.receiver_name }} 电话:{{ item.receiver_phone }} + 收货地址:{{ item.delivery_address }} {{ + item.delivery_address_detail }} + + + + + + + + + 配送方式: + + {{ ["", "快递配送", "到店自提"][item.delivery_type] }} + + + + + 运费: {{ item.delivery_money }}元 + + + + + + + + + 应付: {{ (Number(item.total_price) + Number(item.delivery_money)).toFixed(2) }} 元 + 余额支付: {{ item.pay_balance }} 元 + 优惠: {{ ((Number(item.total_price) + Number(item.delivery_money)) - + item.pay_price).toFixed(2) }} 元 + + 占位 + + 实付: {{ item.pay_price }} 元 + + + + 退款 + + + + + 备注 + + + 发货 + + + + + + + + + + + + + + + + + + diff --git a/store/points/setUp.vue b/store/points/setUp.vue new file mode 100644 index 0000000..1512791 --- /dev/null +++ b/store/points/setUp.vue @@ -0,0 +1,117 @@ + + + + + + + + + + + + + 注:多条内容请使用中文逗号隔开 + + + + + + + + + + 注:只要满足连续签到天数,中间没有断签,就一直赠送奖励积分; + + + + + + + + + + + 已废弃 + + + + + + + + + 保存 + + + + + + + + + + + diff --git a/store/recharge/index.vue b/store/recharge/index.vue index cb310f4..184aeea 100644 --- a/store/recharge/index.vue +++ b/store/recharge/index.vue @@ -2,41 +2,43 @@ - - - 添加充值方案 - + + + + + + 充值管理 + + - - 充值记录 - + + + 添加充值方案 + + + 充值记录 + + + + 设置 + + + - - 设置 - - - + @@ -93,7 +95,7 @@ - 删除 @@ -122,10 +124,13 @@ import { ref, nextTick } from 'vue'; import utils from '@/utils/utils.js'; import recharge from '@/api/store/recharge.js'; +import yList from "/components/yList/index.vue"; import kevyloading from "@/components/kevy-loading/kevy-loading"; import { useMessage } from '@/uni_modules/wot-design-uni'; import { useToast } from '@/uni_modules/wot-design-uni' -import yList from "/components/yList/index.vue"; +import { useApi } from "@/hooks/useApi.js" +const message = useMessage(); +const toast = useToast() import { onShow, @@ -136,41 +141,11 @@ const yListRef = ref(null); const searchType = ref('券名'); const popover = ref(false); -const search = ({ value } = {}) => { - - if (searchType.value == '券名') { - yListRef.value.upData({ - name: params.value.keywords, - }); - } else if (searchType.value == '券金额') { - yListRef.value.upData({ - price: params.value.keywords - }); - } else { - yListRef.value.upData({}); - } - +const search = () => { + yListRef.value.upData({}); }; -const menu = ref([ - { content: '券名' }, - { content: '券金额' }, -]); - -const params = ref({ - name: null, - price: null, - send_type: null -}); - -/** - * 切换搜索类型 - * @param {Object} item - 切换的项 - */ -function changeSearchType({ item, index }) { - searchType.value = item.content; - search(params.value.keywords) -} +const params = ref({}); /** * @type {Ref} @@ -178,15 +153,29 @@ function changeSearchType({ item, index }) { */ const loading = ref(false); -const formatOfTime = (theTimeStamp) => { - const date = new Date(theTimeStamp * 1000); // 将时间戳转换为毫秒 - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - - return `${year}-${month}-${day} ${hours}`; +const delRecharge = (row) => { + message + .confirm({ + title: '删除充值方案', + }) + .then(async (resp) => { + const { fetchData } = await useApi(recharge.del) + + fetchData({ + id: row.id, + }).then(res => { + if (res.code == 0) { + toast.success('操作成功') + search() + } else { + toast.error('出错了') + } + + }) + }) + .catch((error) => { + console.log(error); + }); } // 初始化调用获取一行数据 diff --git a/utils/app.js b/utils/app.js index e705bd1..a01b165 100644 --- a/utils/app.js +++ b/utils/app.js @@ -1,46 +1,3 @@ -// const tabbar = [ -// "pages/index/index", -// "pages/cat/cat", -// "pages/shoppingCart/index", -// "pages/my/my", -// ]; - -/** - * @des 小程序版本更新管理器 - */ -export function getUpdateManager() { - // #ifdef MP-WEIXIN || MP-ALIPAY - const updateManager = uni.getUpdateManager(); - updateManager.onCheckForUpdate((res) => { - // 检测新版本后的回调 - if (res.hasUpdate) { - uni.showModal({ - content: "新版本已经准备好,是否重启应用?", - showCancel: false, - confirmText: "确定", - success: (res) => { - if (res.confirm) { - updateManager.onUpdateReady(() => { - // 新版本下载完成的回调 - updateManager.applyUpdate(); // 强制当前小程序应用上新版本并重启 - }); - - updateManager.onUpdateFailed(() => { - // 新版本下载失败的回调 - // 新版本下载失败,提示用户删除后通过冷启动重新打开 - uni.showModal({ - content: "下载失败,请删除当前小程序后重新打开", - showCancel: false, - confirmText: "知道了", - }); - }); - } - }, - }); - } - }); - // #endif -} /** * @des 获取头部高度 diff --git a/utils/pageList.js b/utils/pageList.js new file mode 100644 index 0000000..3d20f24 --- /dev/null +++ b/utils/pageList.js @@ -0,0 +1,24 @@ +const pageList = [ + { url: '/store/cat/index', name: '商品分类', icon: 'setting1 opacity-80' }, + { url: '/store/goods/index', name: '商品管理', icon: 'goods opacity-80' }, + { url: '/store/user/list', name: '会员管理', icon: 'user opacity-80' }, + { url: '/store/user/memberList', name: '会员等级', icon: 'lenovo opacity-80' }, + { url: '/store/order/index', name: '普通订单', icon: 'cart opacity-80' }, + { url: '/store/afterSale/index', name: '售后订单', icon: 'cart opacity-80' }, + { url: '/store/inpersonPay/index', name: '当面付订单', icon: 'cart opacity-80' }, + { url: '/store/discount/discount/index', name: '限时折扣', icon: 'chart-bubble opacity-80' }, + { url: '/store/discount/full_discount/index', name: '梯度折扣', icon: 'chart-bubble opacity-80' }, + { url: '/store/discount/full_set_redution/index', name: '满额立减', icon: 'chart-bubble opacity-80' }, + { url: '/store/points/setUp', name: '积分设置', icon: 'detection opacity-80' }, + { url: '/store/points/cat', name: '商品分类', icon: 'setting1 opacity-80' }, + { url: '/store/points/goods/index', name: '商品管理', icon: 'goods opacity-80' }, + { url: '/store/points/order', name: '订单管理', icon: 'lenovo opacity-80' }, + { url: '', name: '提现设置', icon: 'chart-bubble opacity-80' }, + { url: '', name: '分销提现', icon: 'chart-bubble opacity-80' }, + { url: '/store/recharge/index', name: '充值管理', icon: 'chart-bubble opacity-80' }, + { url: '/store/coupon/index', name: '优惠券', icon: 'chart-bubble opacity-80' }, + { url: '/store/check/list', name: '核销记录', icon: 'chart-bubble opacity-80' } + // Add more entries if needed +]; + +export default pageList \ No newline at end of file diff --git a/utils/pay.js b/utils/pay.js deleted file mode 100644 index cf53bd7..0000000 --- a/utils/pay.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @des 支付方法 - */ -export function paymentMethod(type) { - switch (type) { - case "1": - console.log("支付宝"); - break; - - case "2": - console.log("微信"); - break; - - case "3": - console.log("余额"); - break; - - case "4": - console.log("货到付款"); - break; - } - -} - -/** - * @des 订单类型 - */ -export function getOrderType(type) { - const obj = { - 1: "商城订单", - 2: "秒杀订单", - 3: "拼团订单", - }; - return obj[type]; -} - -/** - * @des 支付类型 - */ -export function getPayType(type) { - const obj = { - 1: "支付宝", - 2: "微信", - 3: "余额", - 3: "货到付款", - }; - return obj[type]; -} diff --git a/utils/regExp.js b/utils/regExp.js deleted file mode 100644 index 77fc7a0..0000000 --- a/utils/regExp.js +++ /dev/null @@ -1,8 +0,0 @@ -export function regMobile(mobile) { - let re = /^1[2,3,4,5,6,7,8,9][0-9]{9}$/, - result = re.test(mobile); - if (!result) { - return false; - } - return true; -} diff --git a/utils/utils.js b/utils/utils.js index fa6f756..33bf54e 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -1,40 +1,74 @@ import { isGetLocation } from "./location.js"; - -const tabBarList = [ - "/pages/index/index", - "/pages/cat/cat", - "/pages/shoppingCart/index", - "/pages/my/my", -]; +import pageList from "./pageList.js"; export default { // 跳转页面 toUrl(url, type) { console.log(url); - if ( - tabBarList.some((item) => url.indexOf(item) !== -1) && - type != "reLaunch" - ) { - uni.switchTab({ - url: url, - }); + if (!url) { + uni.showToast({ + title: `开发中 ···`, + icon: 'none' + }) + } - return; + try { + if (type == "redirectTo") { + uni.redirectTo({ + url, + }); + } else if (type == "reLaunch") { + uni.reLaunch({ + url, + }); + } else { + uni.navigateTo({ + url, + }); + } + } catch (error) { + console.log(error); } - if (type == "redirectTo") { - uni.redirectTo({ - url, - }); - } else if (type == "reLaunch") { - uni.reLaunch({ - url, - }); - } else { - uni.navigateTo({ - url, + + const isPage = pageList.find(item => item.url === url); + + if (isPage) { + const countUrl = uni.getStorageSync("countUrl") || {}; + + // 增加当前页面的触发次数 + countUrl[url] = (countUrl[url] || 0) + 1; + + // 将更新后的 countUrl 对象保存到存储中 + uni.setStorageSync("countUrl", countUrl); + + // 现在你可以通过 countUrl[url] 访问每个页面的触发次数 + } + }, + + recommendPage() { + try { + const countUrl = uni.getStorageSync("countUrl") || {}; + const sortedPages = Object.keys(countUrl).sort((a, b) => countUrl[b] - countUrl[a]); + + // 取出前 6 条数据 + const topPages = sortedPages.slice(0, 6); + + // 从 pageList 中找到对应的页面信息 + const topPageInfo = topPages.map(url => { + const page = pageList.find(item => item.url === url); + return { + url: page.url, + name: page.name, + icon: page.icon, + triggerCount: countUrl[url] + }; }); + + return topPageInfo || [] + } catch (error) { + return [] } },