功能:同步小程序流程

This commit is contained in:
xiaowang
2026-05-23 18:45:41 +08:00
parent 844516988b
commit 30ae763e18
117 changed files with 8823 additions and 76 deletions
+64
View File
@@ -1,11 +1,23 @@
/**
* Purpose: toIdString supports format.js by holding or executing the to id string page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function toIdString(value) {
return value === undefined || value === null ? '' : String(value)
}
/**
* Purpose: sameId supports format.js by holding or executing the same id page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function sameId(left, right) {
return toIdString(left) === toIdString(right)
}
/**
* Purpose: splitCsv supports format.js by holding or executing the split csv page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function splitCsv(value) {
return String(value || '')
.split(',')
@@ -13,10 +25,18 @@ function splitCsv(value) {
.filter(Boolean)
}
/**
* Purpose: formatPrice supports format.js by holding or executing the format price page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function formatPrice(value) {
return Number(value || 0).toFixed(2)
}
/**
* Purpose: formatDateTime supports format.js by holding or executing the format date time page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function formatDateTime(value) {
if (!value) {
return ''
@@ -25,10 +45,18 @@ function formatDateTime(value) {
return String(value).replace('T', ' ').slice(0, 16)
}
/**
* Purpose: formatDate supports format.js by holding or executing the format date page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function formatDate(value) {
return formatDateTime(value).slice(0, 10)
}
/**
* Purpose: maskPhone supports format.js by holding or executing the mask phone page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function maskPhone(phone) {
const value = String(phone || '')
if (value.length !== 11) {
@@ -37,6 +65,10 @@ function maskPhone(phone) {
return `${value.slice(0, 3)}****${value.slice(7)}`
}
/**
* Purpose: truncateText supports format.js by holding or executing the truncate text page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function truncateText(value, limit) {
const text = String(value || '')
if (!limit || text.length <= limit) {
@@ -45,6 +77,10 @@ function truncateText(value, limit) {
return `${text.slice(0, limit)}...`
}
/**
* Purpose: buildShopName supports format.js by holding or executing the build shop name page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function buildShopName(record) {
if (!record) {
return '未绑定店铺'
@@ -61,10 +97,18 @@ function buildShopName(record) {
return '未绑定店铺'
}
/**
* Purpose: getUserStatusText supports format.js by holding or executing the get user status text page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getUserStatusText(status) {
return Number(status) === 0 ? '已停用' : '正常'
}
/**
* Purpose: getUserTypeText supports format.js by holding or executing the get user type text page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getUserTypeText(type) {
const value = Number(type)
if (value === 4) {
@@ -79,6 +123,10 @@ function getUserTypeText(type) {
return '普通用户'
}
/**
* Purpose: getOrderStatusText supports format.js by holding or executing the get order status text page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getOrderStatusText(order) {
if (order && order.statusText) {
return order.statusText
@@ -94,10 +142,18 @@ function getOrderStatusText(order) {
return '已取消'
}
/**
* Purpose: getCouponTypeText supports format.js by holding or executing the get coupon type text page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getCouponTypeText(type) {
return Number(type) === 1 ? '折扣券' : '满减券'
}
/**
* Purpose: getCouponValueText supports format.js by holding or executing the get coupon value text page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getCouponValueText(coupon) {
if (Number(coupon && coupon.couponType) === 1) {
return `${coupon && coupon.discountValue ? coupon.discountValue : '--'} 折`
@@ -105,6 +161,10 @@ function getCouponValueText(coupon) {
return `满 ${formatPrice(coupon && coupon.minAmount)} 减 ${formatPrice(coupon && coupon.reduceAmount)}`
}
/**
* Purpose: parseDateTimeToPicker supports format.js by holding or executing the parse date time to picker page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function parseDateTimeToPicker(value) {
const text = formatDateTime(value)
if (!text) {
@@ -121,6 +181,10 @@ function parseDateTimeToPicker(value) {
}
}
/**
* Purpose: buildDateTime supports format.js by holding or executing the build date time page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function buildDateTime(date, time) {
if (!date || !time) {
return ''