feat: 新增地址选择插件及订阅消息等多项功能优化
- 新增地址选择插件,支持地图位置选择并返回地址和经纬度 - 新增微信订阅消息发送功能,支持审核结果、提现通知等场景 - 新增订单支付状态查询、提现收款人姓名保存等接口 - 新增服务区域管理,支持按省市区划分并同步到信息发布 - 新增资金流水和营收报表导出功能 - 新增可用优惠券查询、订单退款拆分处理等功能 - 优化后台角标显示、首页数据统计、UI配置下发等 - 修复订单支付并发问题、地区管理逻辑等
这个提交包含在:
@@ -13,20 +13,38 @@ import url from 'node:url'
|
||||
import { describe, it, expect } from './harness.mjs'
|
||||
import { homeApi, messageApi, distributionApi, postApi } from '../common/api/index.js'
|
||||
import { datasets } from '../common/mock/data.js'
|
||||
import { flattenAreaTree, groupAreaTree } from '../common/utils/area.js'
|
||||
|
||||
const ROOT = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), '..')
|
||||
const read = (p) => fs.readFileSync(path.join(ROOT, p), 'utf8')
|
||||
|
||||
describe('对接 · 区域选项来自后台', () => {
|
||||
it('GET /home/areas 仅返回启用区域,按 sort 升序', async () => {
|
||||
const areas = await homeApi.areas()
|
||||
expect(areas).toBeArray()
|
||||
const enabled = datasets.areas
|
||||
.filter((a) => a.enabled)
|
||||
.sort((a, b) => a.sort - b.sort)
|
||||
.map((a) => a.name)
|
||||
expect(areas).toEqual(enabled)
|
||||
expect(areas).toContain('云岩区')
|
||||
describe('对接 · 服务区域来自后台', () => {
|
||||
it('GET /home/areas 返回平铺服务区域,每条自带省/市/区县', async () => {
|
||||
const rows = await homeApi.areas()
|
||||
expect(rows).toBeArray()
|
||||
const yunyan = rows.find((r) => r.district === '云岩区')
|
||||
expect(yunyan).toBeDefined()
|
||||
expect(yunyan.province).toBe('贵州省')
|
||||
expect(yunyan.city).toBe('贵阳市')
|
||||
expect(rows.every((r) => r.province && r.city && r.district)).toBe(true)
|
||||
// 白云区在后台被停用,不应下发
|
||||
expect(rows.some((r) => r.district === '白云区')).toBe(false)
|
||||
})
|
||||
it('GET /home/locate 按坐标匹配到服务区域', async () => {
|
||||
const found = await homeApi.locate({ lat: 26.605, lng: 106.71 })
|
||||
expect(found).toBeDefined()
|
||||
expect(found.city).toBe('贵阳市')
|
||||
expect(found.district).toBe('云岩区')
|
||||
})
|
||||
it('级联选择:按省/市分组,列表筛选只出现区县', async () => {
|
||||
const rows = await homeApi.areas()
|
||||
const tree = groupAreaTree(rows)
|
||||
expect(tree[0].name).toBe('贵州省')
|
||||
expect(tree[0].cities[0].name).toBe('贵阳市')
|
||||
expect(tree[0].cities[0].districts.some((d) => d.name === '云岩区')).toBe(true)
|
||||
const options = flattenAreaTree(rows)
|
||||
expect(options.every((o) => o.key === 'all' || o.key.indexOf('area-') === 0)).toBe(true)
|
||||
expect(options.some((o) => o.label === '云岩区')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户