This commit is contained in:
aihe 2024-04-25 15:54:13 +08:00
parent e228cf5d80
commit 1fd8e286a6
12 changed files with 257 additions and 85 deletions

View File

@ -1,6 +1,7 @@
import apiUrls, { host } from "./url" import apiUrls, { host } from "./url"
export * from "./user" export * from "./user"
export * from "./common" export * from "./common"
export * from "./order"
export { export {
apiUrls, apiUrls,

View File

@ -166,6 +166,10 @@ const dateRangeList = [
{ title: '年', val: 5 }, { title: '年', val: 5 },
] ]
const pageEventNames = {
chooseAddress: "chooseAddress", // 地址选择
}
export { export {
ordStaEnum, ordStaEnum,
@ -191,4 +195,5 @@ export {
kuaidiTypeEnum, kuaidiTypeEnum,
kuaidiTypeList, kuaidiTypeList,
dateRangeList, dateRangeList,
pageEventNames,
} }

View File

@ -95,9 +95,23 @@ const numberToChinese = (num)=> {
return result; return result;
} }
const getAddressDetail = (item= {})=> {
return `${item.countryName||''}${item.provinceName||''}${item.cityName||''}${item.countyName||''}${item.address||''}`
}
const transListKeyTitle = ({ valKey = '', titleKey = '', list = [] })=> {
list.map(t=> {
t.title = t[titleKey]
t.val = t[valKey]
})
return list
}
export { export {
getAddressDetail,
numberToChinese, numberToChinese,
formatTime, formatTime,
formatLocation, formatLocation,
dateUtils dateUtils,
transListKeyTitle
} }

View File

@ -47,10 +47,8 @@
</template> </template>
<script> <script>
import { import * as apiService from "@/common/api"
getEmisCountry,
getEmisRegion
} from "@/common/api"
export default { export default {
watch: { watch: {
@ -108,7 +106,7 @@
} }
}, },
async created() { async created() {
const res = await getEmisCountry() const res = await apiService.getEmisCountry()
this.curCountryList = this.curList = res.rows || [] this.curCountryList = this.curList = res.rows || []
}, },
onHide() { onHide() {
@ -132,7 +130,7 @@
if (parentId == countryId) { if (parentId == countryId) {
parentId = undefined parentId = undefined
} }
const res = await getEmisRegion({ const res = await apiService.getEmisRegion({
parentId, parentId,
countryId countryId
}) })

View File

@ -6,9 +6,17 @@
<image style="height: 50rpx;width: 42rpx;" :src="getCdnUrl(`post/ji.png`)"></image> <image style="height: 50rpx;width: 42rpx;" :src="getCdnUrl(`post/ji.png`)"></image>
</view> </view>
<view style="flex: 1;padding: 0 30rpx;"> <view style="flex: 1;padding: 0 30rpx;">
<u-text text="寄件人信息" size="28" :bold="true"></u-text> <view style="flex: 1;">
<template v-if="modelInfo.sender.name">
<text class="font-weight pr-10">{{modelInfo.sender.name}}</text>
<text class="">{{modelInfo.sender.phone}}</text>
</template>
<template v-else>
<text class="font-weight">寄件人信息</text>
</template>
</view>
<view style="margin: 8rpx 0 0 0;"> <view style="margin: 8rpx 0 0 0;">
<u-text text="请新建您的寄件地址信息" size="26" color="#999"></u-text> <u-text :text="sendDetail" size="26" color="#999"></u-text>
</view> </view>
</view> </view>
<view class="flex-column-center"> <view class="flex-column-center">
@ -34,9 +42,17 @@
</image> </image>
</view> </view>
<view class="pr-30 pl-30" style="flex: 1;"> <view class="pr-30 pl-30" style="flex: 1;">
<u-text text="收件人信息" size="28" :bold="true"></u-text> <view style="flex: 1;">
<template v-if="modelInfo.reciever.name">
<text class="font-weight pr-10">{{modelInfo.reciever.name}}</text>
<text class="">{{modelInfo.reciever.phone}}</text>
</template>
<template v-else>
<text class="font-weight">收件人信息</text>
</template>
</view>
<view style="margin: 8rpx 0 0 0;"> <view style="margin: 8rpx 0 0 0;">
<u-text text="请填写收件人国家、姓名,电话" size="26" color="#999"></u-text> <u-text :text="recieverDetail" size="26" color="#999"></u-text>
</view> </view>
</view> </view>
<view class="flex-column-center"> <view class="flex-column-center">
@ -50,16 +66,28 @@
</template> </template>
<script> <script>
import getCdnUrl from "@/common/getCdnUrl" import { pageEventNames } from "@/common/enum"
import { goto } from "@/common/untool" import { getAddressDetail } from "@/common/util"
export default { export default {
computed: { computed: {
submitInfo: { modelInfo: {
get(){ get(){
return this.value return this.value
} }
} },
sendDetail: {
get(){
const { sender: item } = this.modelInfo
return getAddressDetail(item) || '请填写寄件人国家、姓名,电话'
}
},
recieverDetail: {
get(){
const { reciever: item } = this.modelInfo
return getAddressDetail(item) || '请填写收件人国家、姓名,电话'
}
},
}, },
props: { props: {
value: { value: {
@ -73,18 +101,30 @@
} }
}, },
created() { created() {
this.initEvent()
}, },
onHide() { onHide() {
}, },
unmounted() { unmounted() {
uni.$off(pageEventNames.chooseAddress, this.chooseAddressEventBack)
}, },
methods: { methods: {
getCdnUrl,
handleAddressChoose(type) { // 1 寄件地址 2收件地址 handleAddressChoose(type) { // 1 寄件地址 2收件地址
goto(`address/list?tab=${type}&type=choose`) this.goto(`address/list?tab=${type}&type=choose`)
},
initEvent() {
uni.$on(pageEventNames.chooseAddress, this.chooseAddressEventBack)
},
chooseAddressEventBack({ data, queryOption }){
const { tab } = queryOption
if(tab == 1) {
this.modelInfo.sender = data
}
if(tab == 2) {
this.modelInfo.reciever = data
}
}, },
} }
} }

View File

@ -17,6 +17,12 @@
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue" "^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
}, },
"pages": [ "pages": [
{
"path": "pages/post/openorder",
"style": {
"navigationBarTitleText": "开单"
}
},
{ {
"path": "pages/tabBar/home/home", "path": "pages/tabBar/home/home",
"style": { "style": {
@ -75,12 +81,7 @@
"navigationBarTitleText": "寄件信息" "navigationBarTitleText": "寄件信息"
} }
}, },
{
"path": "pages/post/openorder",
"style": {
"navigationBarTitleText": "开单"
}
},
{ {
"path": "pages/post/detail", "path": "pages/post/detail",
"style": { "style": {

View File

@ -13,7 +13,7 @@
<view class="com-jianju" style="padding-top: 40rpx;"> <view class="com-jianju" style="padding-top: 40rpx;">
<u-row justify="between" align="top"> <u-row justify="between" align="top">
<u-col span="12"> <u-col span="12">
<tpx-tabs :list="tabList" v-model:value="searchParam.tabType" <tpx-tabs :list="tabList" v-model:value="searchParam.addressType"
@tabchange="(val)=> { handleSearchParamChange() }" v-slot="curTab" @tabchange="(val)=> { handleSearchParamChange() }" v-slot="curTab"
> >
<text slot> <text slot>
@ -31,13 +31,13 @@
<view @click="handleItemClick(item)"> <view @click="handleItemClick(item)">
<u-row> <u-row>
<view class="pr-20"> <view class="pr-20">
<u-text :text="'李先生'" size="30" :bold="true"></u-text> <u-text :text="item.name" size="30" :bold="true"></u-text>
</view> </view>
<view> <view>
<u-text :text="'18627068352'" size="28" mode="phone" color="#999"></u-text> <u-text :text="item.phone" size="28" mode="phone" color="#999"></u-text>
</view> </view>
</u-row> </u-row>
<u-text :text="'上海市大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界'" <u-text :text="getAddressDetail(item)"
size="24" margin="20rpx 0 0 0" color="#999" size="24" margin="20rpx 0 0 0" color="#999"
></u-text> ></u-text>
</view> </view>
@ -46,7 +46,7 @@
<u-row custom-style="margin-top:20rpx;" justify="between"> <u-row custom-style="margin-top:20rpx;" justify="between">
<u-row> <u-row>
<text class="pr-20 clr-sub">默认地址</text> <text class="pr-20 clr-sub">默认地址</text>
<u-switch v-model="item.morenTODO" @change="handleDefaultSwitch(item)" active-color="#B12D29" size="34"></u-switch> <u-switch v-model="item.blDefaultFlag" @change="handleDefaultSwitch(item)" active-color="#B12D29" size="34"></u-switch>
</u-row> </u-row>
<u-row> <u-row>
<u-text @click="handleEditItem(item)" text="编辑" prefixIcon="edit-pen" size="26"></u-text> <u-text @click="handleEditItem(item)" text="编辑" prefixIcon="edit-pen" size="26"></u-text>
@ -87,9 +87,10 @@
</template> </template>
<script> <script>
import getCdnUrl from "@/common/getCdnUrl" import * as apiService from "@/common/api"
import { ordStaEnum, ordStatusList, payTypeEnum, payTypeList, dlvTypeEnum, dlvTypeList, dateTypeEnum, dateTypeList } from "@/common/enum" import { pageEventNames } from "@/common/enum"
import { goto, goBack, setClipboardData, confirmModal, showLoading } from "@/common/untool" import { getAddressDetail } from "@/common/util"
const tabList = [ const tabList = [
{ title: '收件地址', val: 1 }, { title: '收件地址', val: 1 },
{ title: '寄件地址', val: 2 }, { title: '寄件地址', val: 2 },
@ -108,15 +109,18 @@
}, },
data() { data() {
return { return {
...JSON.parse(JSON.stringify({ ordStaEnum, ordStatusList, payTypeEnum, payTypeList, dlvTypeEnum, dlvTypeList, dateTypeEnum, dateTypeList })),
tabList , tabList ,
searchParam: { searchParam: {
pageNo: 1,
pageSize: 10,
keyword: '', keyword: '',
tabType: tabList[0].val addressType: tabList[0].val
},
queryOption: {
tab: tabList[0].val, // 当前tab
type: '', // 'choose' 选择操作
}, },
queryOption: {},
dataList: [ dataList: [
{},{},{},{},{},{},{},{}
], ],
showLoadMore: false, showLoadMore: false,
loadedAll: false loadedAll: false
@ -130,58 +134,69 @@
}, },
onLoad(queryOption) { onLoad(queryOption) {
this.queryOption = queryOption this.queryOption = queryOption
this.searchParam.tabType = queryOption.tab || tabList[0].val this.searchParam.addressType = queryOption.tab || tabList[0].val
this.initData(); this.initData();
}, },
onUnload() { unmounted() {
}, },
methods: { methods: {
getCdnUrl, getAddressDetail,
initData(){ initData(){
// showLoading() uni.stopPullDownRefresh();
setTimeout(() => { this.setListData(true)
uni.stopPullDownRefresh();
}, 300);
}, },
setListData() { async setListData(reload) {
if(reload) {
this.searchParam.pageNo = 1
this.showLoading()
}
const res = await apiService.getCustomerUserAddressList(this.searchParam)
const list = res.rows || []
if(reload) {
this.dataList = list
this.hideLoading()
} else {
this.dataList = this.dataList.concat(list)
}
}, },
onScrollBottom() { async onScrollBottom() {
console.log("onScrollBottom");
if (this.loadedAll) { if (this.loadedAll) {
return; return;
} }
this.showLoadMore = true; this.showLoadMore = true;
setTimeout(() => { this.searchParam.pageNo ++
this.setListData(); await this.setListData();
}, 300); this.showLoadMore = false;
},
handleSearchMoreBtn(){
if(!this.showLoadMore) {
// 回显更多条件
Object.keys(this.tmpSearchParam).map(t=> {
this.tmpSearchParam[t] = this.searchParam[t] || ''
})
}
this.showSearchMore = !this.showSearchMore
}, },
handleSearchParamChange(key, val) { handleSearchParamChange(key, val) {
if(key) { if(key) {
this.searchParam[key] = val this.searchParam[key] = val
} }
setTimeout(()=> {
this.setListData(true)
}, 300)
}, },
handleItemClick(item){ handleItemClick(item){
if(this.queryOption.type == "choose") { switch(this.queryOption.type) {
goBack() case 'choose':
uni.$emit(pageEventNames.chooseAddress, {
queryOption: this.queryOption,
data: item
})
this.goBack()
break
;
} }
}, },
handleEditItem(item={}) { handleEditItem(item={}) {
goto(`address/edit?id=${item.id}`) this.goto(`address/edit?id=${item.id}`)
}, },
async handleDelItem(item) { async handleDelItem(item) {
await confirmModal('确认要删除吗?') await this.confirmModal('确认要删除吗?')
}, },
handleDefaultSwitch(item) { handleDefaultSwitch(item) {

90
pages/post/model.js Normal file
View File

@ -0,0 +1,90 @@
export const getOrderModels = ()=> {
return {
"reciever": { // 收件人信息
"country": null,
"name": "",
"phone": null,
"province": null,
"city": null,
"district": null,
"town": null,
"address": null,
"postCode": null,
"email": null,
"company": null
},
"sender": { // 发件人信息
"country": null,
"name": "",
"phone": null,
"province": null,
"city": null,
"district": null,
"town": null,
"address": null,
"postCode": null,
"email": null,
"company": null
},
"custOrderId": null, // 客户单号
"billCode": "", // 运单号
"billCodeSub": null, // 子单号
"orderDate": null,
"userId": '', // 客户id
"openId": null,
"paymentType": null,
"calcFeeType": null,
"custNo": null,
"transLine": null,
"productType": null,
"customsClear": null,
"customsEclaration": null,
"packType": null,
"dispatchMethod": null,
"pickupMethod": null,
"pickStartDate": null,
"pickFinishDate": null,
"intoWarehouseCode": null,
"intoWarehouseName": null,
"intoWarehouseAddress": null,
"intoWarehouseContact": null,
"intoWarehousePhone": null,
"intoWarehouseBillCode": null,
"customerDeliveryBeginTime": null,
"goodsType": null,
"goodsInfo": null,
"totalWeight": null,
"totalVolume": null,
"parcelQty": null,
"billWeight": null,
"volumeWeight": null,
"currency": null,
"settlementWeight": null,
"feeWeight": null,
"freight": null,
"blOverLong": null,
"blOverWeight": null,
"overWeightNumber": null,
"feeRemaker": null,
"realValue": null,
"blDispFd": null,
"transferCode": null,
"transferBillcode": null,
"dispFdDate": null,
"takePieceEmployeeCode": null,
"sendSiteCode": null,
"destinationCode": null,
"destinationProvince": null,
"destinationCity": null,
"destinationCounty": null,
"dispatchUnderlingSiteCode": null,
"destinationCenterCode": null,
"marketManCode": null,
"payee": null,
"salesmen": null,
"operateEmployeeCode": null,
"blMessage": null,
"blAcceptMessage": null
}
}

View File

@ -6,21 +6,18 @@
<u-row justify="between"> <u-row justify="between">
<view style="width: 130rpx;">运单号</view> <view style="width: 130rpx;">运单号</view>
<view style="flex:1;"> <view style="flex:1;">
<tpx-scan-input v-model:value="submitParam.yundanhao"></tpx-scan-input> <tpx-scan-input v-model:value="submitParam.billCode"></tpx-scan-input>
</view> </view>
<view class="pl-10"> <view class="pl-10">
<u-checkbox-group placement="column" @change="handleAgree()"> <u-button @click="handleCreateOrderNo()"
<u-checkbox size="26" labelSize="26" :checked="agreePrivateRule" label="电子主单" custom-style="font-size: 28rpx;padding:0 10rpx;height: 74rpx;" :plain="true" >系统生成</u-button>
label-color=":#999" activeColor="#B12D29"
custom-style="margin-bottom: 10rpx;"></u-checkbox>
</u-checkbox-group>
</view> </view>
</u-row> </u-row>
<u-row justify="between" custom-style="margin-top:20rpx;"> <u-row justify="between" custom-style="margin-top:20rpx;">
<view style="width: 130rpx;">客户</view> <view style="width: 130rpx;">客户</view>
<view style="flex:1;"> <view style="flex:1;">
<tpx-select :list="kehuList" v-model:value="submitParam.kehuid" customStyle="" :isWhite="true"></tpx-select> <tpx-select :list="kehuList" v-model:value="submitParam.userId" customStyle="" :isWhite="true"></tpx-select>
</view> </view>
</u-row> </u-row>
</view> </view>
@ -301,9 +298,9 @@
</template> </template>
<script> <script>
import getCdnUrl from "@/common/getCdnUrl"
import { transListKeyTitle } from "@/common/util"
import { sendTypeEnum, sendTypeList, qingguanList, baoguanList, } from "@/common/enum" import { sendTypeEnum, sendTypeList, qingguanList, baoguanList, } from "@/common/enum"
import { goto } from "@/common/untool"
import BpeAddressinfoTmp from "@/components/buns-post-edit-templates/bpe-addressinfo-tmp" import BpeAddressinfoTmp from "@/components/buns-post-edit-templates/bpe-addressinfo-tmp"
import BpeGoodstaticTmp from "@/components/buns-post-edit-templates/bpe-goodstatic-tmp" import BpeGoodstaticTmp from "@/components/buns-post-edit-templates/bpe-goodstatic-tmp"
import BpeCostTmp from "@/components/buns-post-edit-templates/bpe-cost-tmp" import BpeCostTmp from "@/components/buns-post-edit-templates/bpe-cost-tmp"
@ -311,6 +308,9 @@
import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp" import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
import BpeGoodKuaidiTmp from "@/components/buns-post-edit-templates/bpe-good-kuaidi-tmp" import BpeGoodKuaidiTmp from "@/components/buns-post-edit-templates/bpe-good-kuaidi-tmp"
import * as apiService from "@/common/api"
import { getOrderModels } from "./model"
export default { export default {
components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp }, components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp },
props: { props: {
@ -328,7 +328,6 @@
tipsList: [ tipsList: [
], ],
agreePrivateRule: false,
wayModal: { wayModal: {
show: false, show: false,
}, },
@ -336,6 +335,7 @@
show: false, show: false,
}, },
submitParam: { submitParam: {
...getOrderModels(),
yundanhao: '', yundanhao: '',
stockRoomId: '', stockRoomId: '',
countryId: '', countryId: '',
@ -358,21 +358,29 @@
}, },
onLoad() { onLoad() {
this.initData(); this.initData();
this.initEvent()
}, },
onUnload() { unmounted() {
}, },
methods: { methods: {
getCdnUrl, async initData() {
goto,
initData() {
// uni.showLoading({ // uni.showLoading({
// title: '加载中' // title: '加载中'
// }); // });
this.showLoading()
const res = await apiService.getCustomerUserList()
this.kehuList = transListKeyTitle({ valKey: 'id', titleKey: 'customerFullName', list: res.rows })
this.hideLoading()
}, },
handleAgree() { initEvent() {
this.agreePrivateRule = !this.agreePrivateRule
},
async handleCreateOrderNo() {
const res = await apiService.createOrderNo()
this.submitParam.billCode = res.data
}, },
handleDialogClick(curModal){ handleDialogClick(curModal){
curModal.show = true curModal.show = true

BIN
static/images/kong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -5,7 +5,7 @@ import {
setSessionUserInfo, setSessionUserInfo,
getSessionUserInfo getSessionUserInfo
} from "@/session" } from "@/session"
import { getDicDataJson } from "@/common/api" import * as apiService from "@/common/api"
import { goto } from "@/common/untool" import { goto } from "@/common/untool"
export default { export default {
@ -30,7 +30,7 @@ export default {
state, state,
rootState rootState
}, options) { }, options) {
const resInfo = await getDicDataJson() const resInfo = await apiService.getDicDataJson()
let data = {} let data = {}
// 转换接口返回的数据字典 // 转换接口返回的数据字典
resInfo?.data?.map?.((item)=> { resInfo?.data?.map?.((item)=> {

View File

@ -5,7 +5,7 @@ import {
setSessionUserInfo, setSessionUserInfo,
getSessionUserInfo getSessionUserInfo
} from "@/session" } from "@/session"
import { loginByApp, getInfoByApp } from "@/common/api" import * as apiService from "@/common/api"
import { goto } from "@/common/untool" import { goto } from "@/common/untool"
export default { export default {
@ -42,7 +42,7 @@ export default {
rootState rootState
}, options) { }, options) {
let token = state.token let token = state.token
const resLgn = await loginByApp(options) const resLgn = await apiService.loginByApp(options)
token = resLgn.token token = resLgn.token
setSessionXToken(token) setSessionXToken(token)
@ -70,7 +70,7 @@ export default {
throw new Error('缺少token') throw new Error('缺少token')
} }
const resInfo = await getInfoByApp() const resInfo = await apiService.getInfoByApp()
const info = { const info = {
...resInfo.user, ...resInfo.user,
roles: resInfo.user, roles: resInfo.user,