diff --git a/request/api/regionPicker.js b/request/api/regionPicker.js new file mode 100644 index 0000000..8bdeeb2 --- /dev/null +++ b/request/api/regionPicker.js @@ -0,0 +1,26 @@ +import { get } from './http' + +/** + * 省市区选择器(xk-api type=3) + * 取值:unwrapXkApi → code / result / message + * children/search 仅未软删;resolve 含软删以便回显 + */ + +/** 按 pid 拉一层子节点 xk-api GET /region-picker/children */ +export async function getRegionChildren(pid = 0) { + return await get('/region-picker/children', { pid }, 3) +} + +/** 地名/首拼/全拼合一搜索 xk-api GET /region-picker/search */ +export async function searchRegions(keyword, limit = 30) { + return await get('/region-picker/search', { keyword, limit }, 3) +} + +/** 按省+叶回显 xk-api GET /region-picker/resolve */ +export async function resolveRegionPair(provinceId, cityId) { + return await get( + '/region-picker/resolve', + { province_id: provinceId, city_id: cityId }, + 3, + ) +} diff --git a/subPackages/setup/choose-area.vue b/subPackages/setup/choose-area.vue index 0adee69..c1b2487 100644 --- a/subPackages/setup/choose-area.vue +++ b/subPackages/setup/choose-area.vue @@ -7,22 +7,18 @@ height:' 68rpx',borderRadio:'8rpx'}" placeholder-style="#999999" :border-bottom="false"> - - - - - - - - - - - - - - - 确定 - 保存 + + + + + 选择省市区 + × + + + + + + + {{ item.label }} / + 请选择 + + + + 加载中... + + {{ row.label }} + › + + 无匹配结果 + + + @@ -296,20 +533,7 @@ height:' 68rpx',borderRadio:'8rpx'}"> .btn { margin: 80rpx auto; - .add_btn { - width: 686rpx; - height: 86rpx; - line-height: 86rpx; - background: #4175EE; - text-align: center; - border-radius: 44rpx 44rpx 44rpx 44rpx; - font-size: 32rpx; - font-family: PingFang SC-Regular, PingFang SC; - font-weight: 400; - color: #FFFFFF; - margin: 0rpx auto; - } - + .add_btn, .eidt_btn { width: 686rpx; height: 86rpx; @@ -325,4 +549,89 @@ height:' 68rpx',borderRadio:'8rpx'}"> } } } - \ No newline at end of file + + .region-drawer { + display: flex; + flex-direction: column; + height: 100%; + background: #fff; + box-sizing: border-box; + } + .region-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 24rpx 32rpx; + border-bottom: 1rpx solid #f0f0f0; + flex-shrink: 0; + } + .region-title { + font-size: 32rpx; + font-weight: 600; + color: #1d2129; + } + .region-close { + font-size: 44rpx; + color: #86909c; + line-height: 1; + padding: 0 8rpx; + } + .search-box { + padding: 16rpx 24rpx; + flex-shrink: 0; + } + .search-input { + height: 68rpx; + background: #f6f6f6; + border-radius: 8rpx; + padding: 0 24rpx; + font-size: 28rpx; + } + .crumb-scroll { + white-space: nowrap; + padding: 0 24rpx 16rpx; + flex-shrink: 0; + } + .crumbs { + display: inline-flex; + flex-wrap: nowrap; + } + .crumb { + font-size: 26rpx; + color: #4175EE; + } + .crumb.muted { + color: #86909c; + } + .crumb-sep { + color: #c0c4cc; + } + .list-scroll { + flex: 1; + height: 0; + min-height: 240rpx; + box-sizing: border-box; + } + .list-row { + display: flex; + align-items: center; + justify-content: space-between; + padding: 28rpx 32rpx; + border-bottom: 1rpx solid #f5f5f5; + } + .row-label { + font-size: 28rpx; + color: #1d2129; + flex: 1; + } + .row-arrow { + font-size: 36rpx; + color: #c0c4cc; + } + .empty { + text-align: center; + color: #86909c; + padding: 80rpx 0; + font-size: 28rpx; + } +