已支付订单列表:where.payStatus = 1;

This commit is contained in:
2024-07-10 22:44:18 +08:00
parent 9dd834adb5
commit 1311eb03b8
611 changed files with 92828 additions and 400 deletions
@@ -0,0 +1,547 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const dataPicker = {
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 !== void 0;
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) => {
for (let i = 2; i < newValue.length; i++) {
if (newValue[i] != oldValue[i]) {
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 === void 0) {
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() {
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 = {}) {
let db = common_vendor.Ws.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 !== void 0 ? options.pageCurrent : this.page.current;
const size = options.pageSize !== void 0 ? options.pageSize : this.page.size;
const getCount = options.getcount !== void 0 ? options.getcount : this.getcount;
const getTree = options.gettree !== void 0 ? 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 === void 0 || 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 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 !== void 0 && 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) {
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 [];
}
}
};
exports.dataPicker = dataPicker;
@@ -0,0 +1,152 @@
"use strict";
const uni_modules_uniDataPicker_components_uniDataPickerview_uniDataPicker = require("./uni-data-picker.js");
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "UniDataPickerView",
emits: ["nodeclick", "change", "datachange", "update:modelValue"],
mixins: [uni_modules_uniDataPicker_components_uniDataPickerview_uniDataPicker.dataPicker],
props: {
managedMode: {
type: Boolean,
default: false
},
ellipsis: {
type: Boolean,
default: true
}
},
created() {
if (!this.managedMode) {
this.$nextTick(() => {
this.loadData();
});
}
},
methods: {
onPropsChange() {
this._treeData = [];
this.selectedIndex = 0;
this.$nextTick(() => {
this.loadData();
});
},
handleSelect(index) {
this.selectedIndex = index;
},
handleNodeClick(item, i, j) {
if (item.disable) {
return;
}
const node = this.dataList[i][j];
const text = node[this.map.text];
const value = node[this.map.value];
if (i < this.selected.length - 1) {
this.selected.splice(i, this.selected.length - i);
this.selected.push({
text,
value
});
} else if (i === this.selected.length - 1) {
this.selected.splice(i, 1, {
text,
value
});
}
if (node.isleaf) {
this.onSelectedChange(node, node.isleaf);
return;
}
const {
isleaf,
hasNodes
} = this._updateBindData();
if (this.isLocalData) {
this.onSelectedChange(node, !hasNodes || isleaf);
} else if (this.isCloudDataList) {
this.onSelectedChange(node, true);
} else if (this.isCloudDataTree) {
if (isleaf) {
this.onSelectedChange(node, node.isleaf);
} else if (!hasNodes) {
this.loadCloudDataNode((data) => {
if (!data.length) {
node.isleaf = true;
} else {
this._treeData.push(...data);
this._updateBindData(node);
}
this.onSelectedChange(node, node.isleaf);
});
}
}
},
updateData(data) {
this._treeData = data.treeData;
this.selected = data.selected;
if (!this._treeData.length) {
this.loadData();
} else {
this._updateBindData();
}
},
onDataChange() {
this.$emit("datachange");
},
onSelectedChange(node, isleaf) {
if (isleaf) {
this._dispatchEvent();
}
if (node) {
this.$emit("nodeclick", node);
}
},
_dispatchEvent() {
this.$emit("change", this.selected.slice(0));
}
}
};
if (!Array) {
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
_easycom_uni_load_more2();
}
const _easycom_uni_load_more = () => "../../../uni-load-more/components/uni-load-more/uni-load-more.js";
if (!Math) {
_easycom_uni_load_more();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: !_ctx.isCloudDataList
}, !_ctx.isCloudDataList ? {
b: common_vendor.f(_ctx.selected, (item, index, i0) => {
return {
a: common_vendor.t(item.text || ""),
b: index,
c: index == _ctx.selectedIndex ? 1 : "",
d: common_vendor.o(($event) => $options.handleSelect(index), index)
};
})
} : {}, {
c: common_vendor.f(_ctx.dataList[_ctx.selectedIndex], (item, j, i0) => {
return common_vendor.e({
a: common_vendor.t(item[_ctx.map.text]),
b: _ctx.selected.length > _ctx.selectedIndex && item[_ctx.map.value] == _ctx.selected[_ctx.selectedIndex].value
}, _ctx.selected.length > _ctx.selectedIndex && item[_ctx.map.value] == _ctx.selected[_ctx.selectedIndex].value ? {} : {}, {
c: !!item.disable ? 1 : "",
d: j,
e: common_vendor.o(($event) => $options.handleNodeClick(item, _ctx.selectedIndex, j), j)
});
}),
d: _ctx.loading
}, _ctx.loading ? {
e: common_vendor.p({
contentText: _ctx.loadMore,
status: "loading"
})
} : {}, {
f: _ctx.errorMessage
}, _ctx.errorMessage ? {
g: common_vendor.t(_ctx.errorMessage)
} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue"]]);
wx.createComponent(Component);
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"uni-load-more": "../../../uni-load-more/components/uni-load-more/uni-load-more"
}
}
@@ -0,0 +1 @@
<view class="uni-data-pickerview"><scroll-view wx:if="{{a}}" class="selected-area" scroll-x="true"><view class="selected-list"><view wx:for="{{b}}" wx:for-item="item" wx:key="b" class="{{['selected-item', item.c && 'selected-item-active']}}" bindtap="{{item.d}}"><text>{{item.a}}</text></view></view></scroll-view><view class="tab-c"><scroll-view class="list" scroll-y="{{true}}"><view wx:for="{{c}}" wx:for-item="item" wx:key="d" class="{{['item', item.c && 'is-disabled']}}" bindtap="{{item.e}}"><text class="item-text">{{item.a}}</text><view wx:if="{{item.b}}" class="check"></view></view></scroll-view><view wx:if="{{d}}" class="loading-cover"><uni-load-more wx:if="{{e}}" class="load-more" u-i="51653c41-0" bind:__l="__l" u-p="{{e}}"></uni-load-more></view><view wx:if="{{f}}" class="error-message"><text class="error-text">{{g}}</text></view></view></view>
@@ -0,0 +1,134 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-data-pickerview {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
height: 100%;
}
.error-text {
color: #DD524D;
}
.loading-cover {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.5);
display: flex;
flex-direction: column;
align-items: center;
z-index: 1001;
}
.load-more {
margin: auto;
}
.error-message {
background-color: #fff;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
padding: 15px;
opacity: 0.9;
z-index: 102;
}
.selected-list {
display: flex;
flex-wrap: nowrap;
flex-direction: row;
padding: 0 5px;
border-bottom: 1px solid #f8f8f8;
}
.selected-item {
margin-left: 10px;
margin-right: 10px;
padding: 12px 0;
text-align: center;
white-space: nowrap;
}
.selected-item-text-overflow {
width: 168px;
/* fix nvue */
overflow: hidden;
width: 6em;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
.selected-item-active {
border-bottom: 2px solid #007aff;
}
.selected-item-text {
color: #007aff;
}
.tab-c {
position: relative;
flex: 1;
display: flex;
flex-direction: row;
overflow: hidden;
}
.list {
flex: 1;
}
.item {
padding: 12px 15px;
/* border-bottom: 1px solid #f0f0f0; */
display: flex;
flex-direction: row;
justify-content: space-between;
}
.is-disabled {
opacity: 0.5;
}
.item-text {
/* flex: 1; */
color: #333333;
}
.item-text-overflow {
width: 280px;
/* fix nvue */
overflow: hidden;
width: 20em;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
.check {
margin-right: 5px;
border: 2px solid #007aff;
border-left: 0;
border-top: 0;
height: 12px;
width: 6px;
transform-origin: center;
transition: all 0.3s;
transform: rotate(45deg);
}