This commit is contained in:
aihe 2024-04-28 17:50:39 +08:00
parent 82d0fc864b
commit 328cafc9cd
6 changed files with 65 additions and 17 deletions

View File

@ -18,8 +18,29 @@ export const getTransLineList = (data = {})=> {
return coreRequest(url.getTransLineList, data, {}, 'GET')
}
export const getTransProductList = (data = {})=> {
return coreRequest(url.getTransProductList, data, {}, 'GET')
}
export const setDefaultAddressById = (data = {})=> {
return coreRequest(url.setDefaultAddressById, data, {}, 'GET')
}
export const deleteAddressById = (data = {})=> {
return coreRequest(url.deleteAddressById, data, {}, 'GET')
}
export const addAddress = (data = {})=> {
return coreRequest(url.addAddress, data, {}, 'GET')
}
export const editAddress = (data = {})=> {
return coreRequest(url.editAddress, data, {}, 'GET')
}
export const getAddressById = (data = {})=> {
return coreRequest(url.getAddressById, data, {}, 'GET')
}

View File

@ -5,15 +5,23 @@ export default {
uploadFile: '/common/ossUpload',
loginByApp: `/loginByApp`, // 登录
getInfoByApp: `/getInfoByApp`,// 获取用户基本信息
getEmisCountry: `/emis/emisCountry/list`, // 获取国家列表
getEmisRegion: `/emis/emisRegion/list`,// 获取省市区列表
getDicDataJson: `/common/getDicDataJson`, // 获取枚举字段
getCustomerUserAddressList: `/emis/emisCustomerAddress/listSimple`, // 获取客户地址列表
setDefaultAddressById: `/emis/emisCustomerAddress/setDefaultAddressById`, // 设置默认地址
deleteAddressById: `/emis/emisCustomerAddress/deleteAddressById`, // 删除地址
addAddress: `/emis/emisCustomerAddress/addAddress`, // 新增地址
editAddress: `/emis/emisCustomerAddress/editAddress`, // 编辑地址
getAddressById: `/emis/emisCustomerAddress/getAddressById`, // 查看地址
getTransLineList: `/emis/emisTransLine/listSimple`, // 获取路线列表
getTransProductList: `/emis/emisTransProduct/listSimple`, // 获取产品列表
createOrderNo: `/emis/common/realMatchWaybill`, // 创建运单号
submitOrder: `/emis/emisWaybill/realSubmitOrder`, // 提交订单
getCustomerUserList: `/emis/emisCustomerUser/listSimple`, // 获取网点客户列表
getCustomerUserAddressList: `/emis/emisCustomerAddress/listSimple`, // 获取客户地址列表
getPickStaffList: `/emis/emisStaff/getStaffList`, // 获取操作、收派 员用户列表
getGoodsList: `/emis/emisGoods/listSimple`, // 获取货物列表
getMonthpayAccountList: `/emis/emisMonthpayAccount/listSimple`, // 月结账号列表

View File

@ -1,9 +1,11 @@
import { goto } from "./untool";
import { showToast } from "./untool"
import { showToast, showLoading, hideLoading } from "./untool"
// 请求接口
function dealRequest(def, url, param) {
if(param && param._loading) {
showLoading()
}
const promise = new Promise(function(resolve, reject) {
def.then(function(response) {
let {
@ -40,7 +42,7 @@ function dealRequest(def, url, param) {
// 统一提示 errmsg
promise.then(function(res) {}, function(res) {
uni.hideLoading()
hideLoading()
})
return promise;
}

View File

@ -34,7 +34,7 @@ let coreRequest = function(url, params = {}, options = {}, methodType) {
...BaseParam,
...params,
}
return dealRequest(coreRequestBase(url, reqParams, options, methodType)).then(res => {
return dealRequest(coreRequestBase(url, reqParams, options, methodType), url, reqParams).then(res => {
// 解析unicode
// emoUnicode(res, 2)
return res

View File

@ -22,7 +22,7 @@
<view v-if="item.letters" class="pr-20">{{item.letters}}</view>
<view style="flex: 1;">
<view v-for="(sItem, sIndex) in item.data"
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.id) > -1?'active':''}`"
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`"
@click="selectItemRegion(sItem)">
{{sItem.name}}
<view class="chk">
@ -131,13 +131,15 @@
parentId = undefined
}
const res = await apiService.getEmisRegion({
parentId,
countryId
regionType: this.curTabIndex + 1, // 必填
parentCode: parentId,
countryCode: countryId,
})
const list = res.rows || []
list.map(t => {
t.name = t.regionName
t.nameEn = t.regionNameEn
t.code = t.code || t.regionCode
})
if (list.length > 0) {
this.curList = list
@ -149,12 +151,15 @@
if (index == 0) {
this.curList = this.curCountryList
} else {
this.getListData()
let parentId = this.submitVals.regIds[index]
this.getListData({
parentId
})
}
},
async addEmptyItem(item) {
const list = await this.getListData({
parentId: item.id
parentId: item.code
})
if (list.length > 0) {
this.curTabIndex = this.curTabIndex + 1
@ -164,10 +169,10 @@
},
async selectItemRegion(item = {}) {
// 选择数据变化,需清除下所有层级选中数据
if (item.id != this.submitVals[this.curTabIndex]) {
if (item.code != this.submitVals.regIds[this.curTabIndex]) {
this.submitVals.regIds.length = this.curTabIndex
this.submitVals.regNames.length = this.curTabIndex
this.submitVals.regIds.push(item.id)
this.submitVals.regIds.push(item.code)
this.submitVals.regNames.push(item.name)
}
// 选中后切换下一层级视图

View File

@ -3,7 +3,9 @@
<template v-slot:header> </template>
<template v-slot:body>
<view class="pos-abt-all">
<tpx-scroll-view v-model:resObject="resData" :searchParam="searchParam" :getListFun="getListFun">
<tpx-scroll-view v-model:resObject="resData" :searchParam="searchParam" :getListFun="getListFun"
ref="listRef"
>
<view class="pgb-header">
<view class="com-jianju">
<!-- 关键字搜索框 -->
@ -46,7 +48,7 @@
<u-row custom-style="margin-top:20rpx;" justify="between">
<u-row>
<text class="pr-20 clr-sub">默认地址</text>
<u-switch v-model="item.blDefaultFlag" @change="handleDefaultSwitch(item)" active-color="#B12D29" size="34"></u-switch>
<u-switch v-model="item.blDefaultFlag" @change="handleDefaultSwitch(item)" activeValue="1" active-color="#B12D29" size="34"></u-switch>
</u-row>
<u-row>
<u-text @click="handleEditItem(item)" text="编辑" prefixIcon="edit-pen" size="26"></u-text>
@ -154,9 +156,19 @@
},
async handleDelItem(item) {
await this.confirmModal('确认要删除吗?')
await apiService.deleteAddressById({ id: item.id, _loading: true })
this.showToast('操作成功')
this.$refs.listRef.getDataList(true) // 重置到第一页数据
},
handleDefaultSwitch(item) {
async handleDefaultSwitch(item) {
try{
await apiService.setDefaultAddressById({ id: item.id, _loading: true })
this.showToast('操作成功')
this.$refs.listRef.getDataList(true) // 重置到第一页数据
}catch(e){
// 操作失败,切回按钮状态
item.blDefaultFlag = !item.blDefaultFlag
}
},
}
}