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"
export * from "./user"
export * from "./common"
export * from "./order"
export {
apiUrls,

View File

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

View File

@ -95,9 +95,23 @@ const numberToChinese = (num)=> {
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 {
getAddressDetail,
numberToChinese,
formatTime,
formatLocation,
dateUtils
dateUtils,
transListKeyTitle
}

View File

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

View File

@ -6,9 +6,17 @@
<image style="height: 50rpx;width: 42rpx;" :src="getCdnUrl(`post/ji.png`)"></image>
</view>
<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;">
<u-text text="请新建您的寄件地址信息" size="26" color="#999"></u-text>
<u-text :text="sendDetail" size="26" color="#999"></u-text>
</view>
</view>
<view class="flex-column-center">
@ -34,9 +42,17 @@
</image>
</view>
<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;">
<u-text text="请填写收件人国家、姓名,电话" size="26" color="#999"></u-text>
<u-text :text="recieverDetail" size="26" color="#999"></u-text>
</view>
</view>
<view class="flex-column-center">
@ -50,16 +66,28 @@
</template>
<script>
import getCdnUrl from "@/common/getCdnUrl"
import { goto } from "@/common/untool"
import { pageEventNames } from "@/common/enum"
import { getAddressDetail } from "@/common/util"
export default {
computed: {
submitInfo: {
modelInfo: {
get(){
return this.value
}
}
},
sendDetail: {
get(){
const { sender: item } = this.modelInfo
return getAddressDetail(item) || '请填写寄件人国家、姓名,电话'
}
},
recieverDetail: {
get(){
const { reciever: item } = this.modelInfo
return getAddressDetail(item) || '请填写收件人国家、姓名,电话'
}
},
},
props: {
value: {
@ -73,18 +101,30 @@
}
},
created() {
this.initEvent()
},
onHide() {
},
unmounted() {
uni.$off(pageEventNames.chooseAddress, this.chooseAddressEventBack)
},
methods: {
getCdnUrl,
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"
},
"pages": [
{
"path": "pages/post/openorder",
"style": {
"navigationBarTitleText": "开单"
}
},
{
"path": "pages/tabBar/home/home",
"style": {
@ -75,12 +81,7 @@
"navigationBarTitleText": "寄件信息"
}
},
{
"path": "pages/post/openorder",
"style": {
"navigationBarTitleText": "开单"
}
},
{
"path": "pages/post/detail",
"style": {

View File

@ -13,7 +13,7 @@
<view class="com-jianju" style="padding-top: 40rpx;">
<u-row justify="between" align="top">
<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"
>
<text slot>
@ -31,13 +31,13 @@
<view @click="handleItemClick(item)">
<u-row>
<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>
<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>
</u-row>
<u-text :text="'上海市大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界大世界'"
<u-text :text="getAddressDetail(item)"
size="24" margin="20rpx 0 0 0" color="#999"
></u-text>
</view>
@ -46,7 +46,7 @@
<u-row custom-style="margin-top:20rpx;" justify="between">
<u-row>
<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-text @click="handleEditItem(item)" text="编辑" prefixIcon="edit-pen" size="26"></u-text>
@ -87,9 +87,10 @@
</template>
<script>
import getCdnUrl from "@/common/getCdnUrl"
import { ordStaEnum, ordStatusList, payTypeEnum, payTypeList, dlvTypeEnum, dlvTypeList, dateTypeEnum, dateTypeList } from "@/common/enum"
import { goto, goBack, setClipboardData, confirmModal, showLoading } from "@/common/untool"
import * as apiService from "@/common/api"
import { pageEventNames } from "@/common/enum"
import { getAddressDetail } from "@/common/util"
const tabList = [
{ title: '收件地址', val: 1 },
{ title: '寄件地址', val: 2 },
@ -108,15 +109,18 @@
},
data() {
return {
...JSON.parse(JSON.stringify({ ordStaEnum, ordStatusList, payTypeEnum, payTypeList, dlvTypeEnum, dlvTypeList, dateTypeEnum, dateTypeList })),
tabList ,
searchParam: {
pageNo: 1,
pageSize: 10,
keyword: '',
tabType: tabList[0].val
addressType: tabList[0].val
},
queryOption: {
tab: tabList[0].val, // 当前tab
type: '', // 'choose' 选择操作
},
queryOption: {},
dataList: [
{},{},{},{},{},{},{},{}
],
showLoadMore: false,
loadedAll: false
@ -130,58 +134,69 @@
},
onLoad(queryOption) {
this.queryOption = queryOption
this.searchParam.tabType = queryOption.tab || tabList[0].val
this.searchParam.addressType = queryOption.tab || tabList[0].val
this.initData();
},
onUnload() {
unmounted() {
},
methods: {
getCdnUrl,
getAddressDetail,
initData(){
// showLoading()
setTimeout(() => {
uni.stopPullDownRefresh();
}, 300);
uni.stopPullDownRefresh();
this.setListData(true)
},
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() {
console.log("onScrollBottom");
async onScrollBottom() {
if (this.loadedAll) {
return;
}
this.showLoadMore = true;
setTimeout(() => {
this.setListData();
}, 300);
},
handleSearchMoreBtn(){
if(!this.showLoadMore) {
// 回显更多条件
Object.keys(this.tmpSearchParam).map(t=> {
this.tmpSearchParam[t] = this.searchParam[t] || ''
})
}
this.showSearchMore = !this.showSearchMore
this.searchParam.pageNo ++
await this.setListData();
this.showLoadMore = false;
},
handleSearchParamChange(key, val) {
if(key) {
this.searchParam[key] = val
}
setTimeout(()=> {
this.setListData(true)
}, 300)
},
handleItemClick(item){
if(this.queryOption.type == "choose") {
goBack()
switch(this.queryOption.type) {
case 'choose':
uni.$emit(pageEventNames.chooseAddress, {
queryOption: this.queryOption,
data: item
})
this.goBack()
break
;
}
},
handleEditItem(item={}) {
goto(`address/edit?id=${item.id}`)
this.goto(`address/edit?id=${item.id}`)
},
async handleDelItem(item) {
await confirmModal('确认要删除吗?')
await this.confirmModal('确认要删除吗?')
},
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">
<view style="width: 130rpx;">运单号</view>
<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 class="pl-10">
<u-checkbox-group placement="column" @change="handleAgree()">
<u-checkbox size="26" labelSize="26" :checked="agreePrivateRule" label="电子主单"
label-color=":#999" activeColor="#B12D29"
custom-style="margin-bottom: 10rpx;"></u-checkbox>
</u-checkbox-group>
<u-button @click="handleCreateOrderNo()"
custom-style="font-size: 28rpx;padding:0 10rpx;height: 74rpx;" :plain="true" >系统生成</u-button>
</view>
</u-row>
<u-row justify="between" custom-style="margin-top:20rpx;">
<view style="width: 130rpx;">客户</view>
<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>
</u-row>
</view>
@ -301,9 +298,9 @@
</template>
<script>
import getCdnUrl from "@/common/getCdnUrl"
import { transListKeyTitle } from "@/common/util"
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 BpeGoodstaticTmp from "@/components/buns-post-edit-templates/bpe-goodstatic-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 BpeGoodKuaidiTmp from "@/components/buns-post-edit-templates/bpe-good-kuaidi-tmp"
import * as apiService from "@/common/api"
import { getOrderModels } from "./model"
export default {
components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp },
props: {
@ -328,7 +328,6 @@
tipsList: [
],
agreePrivateRule: false,
wayModal: {
show: false,
},
@ -336,6 +335,7 @@
show: false,
},
submitParam: {
...getOrderModels(),
yundanhao: '',
stockRoomId: '',
countryId: '',
@ -358,21 +358,29 @@
},
onLoad() {
this.initData();
this.initEvent()
},
onUnload() {
unmounted() {
},
methods: {
getCdnUrl,
goto,
initData() {
async initData() {
// uni.showLoading({
// title: '加载中'
// });
this.showLoading()
const res = await apiService.getCustomerUserList()
this.kehuList = transListKeyTitle({ valKey: 'id', titleKey: 'customerFullName', list: res.rows })
this.hideLoading()
},
handleAgree() {
this.agreePrivateRule = !this.agreePrivateRule
initEvent() {
},
async handleCreateOrderNo() {
const res = await apiService.createOrderNo()
this.submitParam.billCode = res.data
},
handleDialogClick(curModal){
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,
getSessionUserInfo
} from "@/session"
import { getDicDataJson } from "@/common/api"
import * as apiService from "@/common/api"
import { goto } from "@/common/untool"
export default {
@ -30,7 +30,7 @@ export default {
state,
rootState
}, options) {
const resInfo = await getDicDataJson()
const resInfo = await apiService.getDicDataJson()
let data = {}
// 转换接口返回的数据字典
resInfo?.data?.map?.((item)=> {

View File

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