Browse Source

订单详情

devlop
邓雄飞 4 years ago
parent
commit
0e6602384e
17 changed files with 384 additions and 112 deletions
  1. 11
      apis/addUserApi.js
  2. 10
      apis/commonApi.js
  3. 36
      apis/orderApi.js
  4. 4
      components/bussiness-components/packingStationItem.vue
  5. 2
      components/qn-map/qn-map.nvue
  6. 6
      manifest.json
  7. 61
      pages/add-user/index.vue
  8. 150
      pages/client-detail/index.vue
  9. 176
      pages/order-detail/index.vue
  10. 6
      pages/page-view/index.vue
  11. 4
      static/icon/iconfont.css
  12. BIN
      static/icon/iconfont.ttf
  13. BIN
      static/imgs/order/camera.png
  14. 4
      utils/hook.js
  15. 3
      utils/http/http.js
  16. 9
      utils/http/index.js
  17. 14
      utils/index.js

11
apis/addUserApi.js

@ -23,3 +23,14 @@ export function addCustomer(data) {
data
})
}
/**
* 根据企业名称查询企业坐标列表
* @param {*} data
* @returns
*/
export function getCompanyLocationList(data) {
return http.get({
url: '/yyt-uec/get/enterprise/geographic/position/address',
data
})
}

10
apis/commonApi.js

@ -76,3 +76,13 @@ export function getVerifyUrl(data = {}) {
export function getGuaranteeContract(data = {}) {
return http.post({ url: '/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=' + data.mallSupplierId, data })
}
/**
* 转换合同成图片
* @param {object} data 图片地址链接 fileUrl
*/
export function transformFileToImg(data) {
http.get({
url: '/document/get/enterprise-documents/file-image-base64',
data: data
})
}

36
apis/orderApi.js

@ -47,3 +47,39 @@ export function confirmSupplierOrder(data) {
data
})
}
/**
* 供应商操作纸品状态
* @param {object} data
* @returns {Promise<Object>}
*/
export function supplierOperatePaper(data) {
return http.post({
url: '/base-paper-trading/supplier/submit/outbound/delivery',
data
})
}
/**
* 供应商上传送货凭证
* @param {object} data
* @returns {Promise<Object>}
*/
export function supplierUploadVoucher(data) {
return http.post({
url: '/base-paper-trading/supplier/submit/upload/delivery/voucher',
data
})
}
/**
* 供应商确认送货
* @param {object} data supplierOrderId
* @returns {Promise<Object>}
*/
export function supplierDelivery(data) {
return http.post({
url: '/base-paper-trading/supplier/submit/confirm/delivery',
data
})
}

4
components/bussiness-components/packingStationItem.vue

@ -10,7 +10,7 @@
<view class="desc">
<text>{{ transformBusiness(info.business) }}</text>
</view>
<view v-show="info.whetherCooperation === 1" class="box-area">
<view v-if="info.whetherCooperation === 1" class="box-area">
<view class="box">
<view><text class="title">月采购量</text></view>
<view style="margin-top: 16rpx">
@ -30,7 +30,7 @@
</view>
</view>
</view>
<view v-show="info.whetherCooperation === 0" class="box-area">
<view v-if="info.whetherCooperation === 0" class="box-area">
<view class="box">
<view><text class="title">法定代表人</text></view>
<view style="margin-top: 16rpx">

2
components/qn-map/qn-map.nvue

@ -49,9 +49,11 @@ export default {
watch: {
// 只监听items一层变化
items(val) {
console.log('val:',val)
this.markers = val.map((item) => {
return this.causeMarker(item)
})
console.log('res:',this.markers)
this.mapContext.addMarkers({
markers: this.markers,
clear: true,

6
manifest.json

@ -35,18 +35,21 @@
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>"
@ -77,7 +80,8 @@
"appkey_ios" : "0182ee2a9fdd5fd3ef6a8bd5a2f98325",
"appkey_android" : "877848546f7f3717101a17c33e1d4df3"
}
}
},
"share" : {}
}
},
"uniStatistics" : {

61
pages/add-user/index.vue

@ -73,6 +73,9 @@
></qn-easyinput>
</view>
</view>
<qn-form-item label="点击定位" required v-if="!hasSelected">
<image @click="showLocationList" style="width: 32rpx; height: 32rpx" src="/static/imgs/order/location-icon.png"></image>
</qn-form-item>
<view class="qn-form-item qn-form-item">
<view class="label">
<uni-icons custom-prefix="iconfont" type="icon-required" size="14" color="#F5222D"></uni-icons>
@ -81,7 +84,7 @@
<view class="value">
<!-- <qn-easyinput v-model="form.shortName" :inputBorder="false" text="right" placeholder="选择所在区域"></qn-easyinput> -->
<qn-data-picker
:readonly="hasSelected"
:readonly="true"
text="right"
:border="false"
class="qn-picker"
@ -106,12 +109,12 @@
<view class="value">
<qn-easyinput
:maxlength="20"
:disabled="hasSelected"
:disabled="true"
:styles="{ disableColor: '#fff' }"
v-model="form.locDetail"
:inputBorder="false"
text="right"
placeholder="请输入详细地址"
placeholder="请定位详细地址"
></qn-easyinput>
</view>
</view>
@ -243,6 +246,21 @@
</scroll-view>
</view>
</uni-popup>
<uni-popup ref="locationPopup" type="bottom">
<view class="popup_modal">
<slot name="title">
<view class="popup_modal-title">可选择以下定位公司</view>
</slot>
<scroll-view scroll-y="true" class="popup_modal-scroll">
<view @click="selectLocation(item)" style="height: 100rpx" class="popup_modal-scroll-item" v-for="(item, index) in locationList" :key="index">
<view class="location-item">
<text class="title">{{ item.enterpriseName }}</text>
<text class="address">{{ `${item.provinceName}/${item.cityName}/${item.districtName}/${item.address}` }}</text>
</view>
</view>
</scroll-view>
</view>
</uni-popup>
<qn-footer fixed height="120rpx">
<view class="button-area">
<view class="button button__cancel" @click="back">
@ -259,7 +277,7 @@
<script>
import { back, uploadImage } from '@/utils/hook.js'
import { getArea } from '@/apis/commonApi.js'
import { getCompanyList, getCompanyInfoById, addCustomer } from '@/apis/addUserApi.js'
import { getCompanyList, getCompanyInfoById, addCustomer, getCompanyLocationList } from '@/apis/addUserApi.js'
import qnEasyinput from '@/components/qn-easyinput/qn-easyinput.vue'
import qnDataPicker from '@/components/qn-data-picker/qn-data-picker.vue'
import qnDatetimePicker from '@/components/qn-datetime-picker/qn-datetime-picker.vue'
@ -314,6 +332,7 @@ export default {
registeredCapital: null,
foundDate: null
},
locationList: [],
searchList: [],
hasSelected: false,
items: []
@ -341,6 +360,38 @@ export default {
})
}
},
showLocationList() {
if (!this.form.name || !this.form.name.trim()) {
uni.showToast({
title: '请先填写公司名称',
icon: 'none'
})
return
}
getCompanyLocationList({ enterpriseName: this.form.name }).then((res) => {
if (res) {
this.locationList = res
this.$refs.locationPopup.open('bottom')
} else {
uni.showToast({
title: '暂无定位公司',
icon: 'error'
})
}
})
},
selectLocation(location) {
this.form.locProvinceId = location.provinceCode
this.form.locCityId = location.cityCode
this.form.locDistrictId = location.districtCode
this.form.locProvinceName = location.provinceName
this.form.locCityName = location.cityName
this.form.locDistrictName = location.districtName
this.form.locDetail = location.address
this.form.regAddrLongitude = location.longitude
this.form.regAddrLatitude = location.latitude
this.$refs.locationPopup.close()
},
selectCompany(enterpriseId) {
this.$refs.popup.close()
getCompanyInfoById({ enterpriseId }).then((res) => {
@ -368,6 +419,8 @@ export default {
this.form.locDetail = info.locDetail
this.form.registeredCapital = info.registeredCapital
this.form.foundDate = info.foundDate
this.form.regAddrLongitude = info.regAddrLongitude
this.form.regAddrLatitude = info.regAddrLatitude
},
onAreaChange(e) {
if (e.detail.value && e.detail.value.length > 0) {

150
pages/client-detail/index.vue

@ -1,23 +1,29 @@
<template>
<view class="warpper">
<qnHeader class="header">
<!-- <view class="header"> -->
<view class="header-title">客户详情</view>
<view class="right-title">客户授信</view>
<!-- </view> -->
</qnHeader>
<view>
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#007AFF" class="segmented"></uni-segmented-control>
<view class="content">
<view v-show="current === 0"><basicInformation ref="basicInformationRef" :customerId="customerId"></basicInformation></view>
<view v-show="current === 1"><equipmentInformation></equipmentInformation></view>
<view v-show="current === 2"><basePaperDeals></basePaperDeals></view>
<view v-show="current === 3"><wastePaperTrading></wastePaperTrading></view>
</view>
</view>
</view>
<view class="warpper">
<qnHeader class="header">
<!-- <view class="header"> -->
<view class="header-title">客户详情</view>
<view class="right-title" @click="go2('client-credit')">客户授信</view>
<!-- </view> -->
</qnHeader>
<view>
<uni-segmented-control
:current="current"
:values="items"
@clickItem="onClickItem"
styleType="text"
activeColor="#007AFF"
class="segmented"
></uni-segmented-control>
<view class="content">
<view v-show="current === 0"><basicInformation ref="basicInformationRef" :customerId="customerId"></basicInformation></view>
<view v-show="current === 1"><equipmentInformation></equipmentInformation></view>
<view v-show="current === 2"><basePaperDeals></basePaperDeals></view>
<view v-show="current === 3"><wastePaperTrading></wastePaperTrading></view>
</view>
</view>
</view>
</template>
<script>
@ -26,65 +32,65 @@ import basicInformation from './basic-information.vue'
import equipmentInformation from './equipment-information.vue'
import basePaperDeals from './base-paper-deals.vue'
import wastePaperTrading from './waste-paper-trading.vue'
import { go2 } from '@/utils/hook.js'
export default {
components: {
qnHeader,
basicInformation,
equipmentInformation,
basePaperDeals,
wastePaperTrading
},
data() {
return {
current: 0,
items: ['基础信息', '设备信息', '原纸交易', '废纸交易'],
customerId: null,
}
},
onLoad(option) {
this.customerId = option.id || '800890'
this.$nextTick(() => {
this.$refs.basicInformationRef.getBaseInfo()
})
},
methods: {
onClickItem(e) {
console.log('e', e)
this.current = e.currentIndex
},
}
components: {
qnHeader,
basicInformation,
equipmentInformation,
basePaperDeals,
wastePaperTrading
},
data() {
return {
current: 0,
items: ['基础信息', '设备信息', '原纸交易', '废纸交易'],
customerId: null
}
},
onLoad(option) {
this.customerId = option.id || '800890'
this.$nextTick(() => {
this.$refs.basicInformationRef.getBaseInfo()
})
},
methods: {
go2,
onClickItem(e) {
console.log('e', e)
this.current = e.currentIndex
}
}
}
</script>
<style lang="scss" scoped>
.warpper {
.header {
justify-content: space-between;
}
.header-title {
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
.header {
justify-content: space-between;
}
.header-title {
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
.right-title {
font-size: 28rpx;
color: #007aff;
text-align: center;
line-height: 40rpx;
font-weight: 500;
}
.segmented {
height: 88rpx;
border-bottom: 2rpx solid #ECECEC;
font-size: 28rpx;
color: #333333;
text-align: center;
font-weight: 400;
}
.right-title {
font-size: 28rpx;
color: #007aff;
text-align: center;
line-height: 40rpx;
font-weight: 500;
}
.segmented {
height: 88rpx;
border-bottom: 2rpx solid #ececec;
font-size: 28rpx;
color: #333333;
text-align: center;
font-weight: 400;
}
}
</style>

176
pages/order-detail/index.vue

@ -30,20 +30,22 @@
<text style="font-size: 30rpx; font-weight: 600; line-height: 1.2">
{{ `${order.brandName}${order.productName} | ${order.gramWeight}g | ${order.width}*${order.length} | ${order.pieceQuantity}` }}
</text>
<view v-if="steps[index].length > 0 && steps[index][0].desc == '未完成'" class="button-item" @click="operatePaper(index, 'cut')">分切</view>
<view
v-else-if="steps[index].length > 0 && steps[index][steps[index].length - 2].desc == '未完成'"
class="button-item"
@click="operatePaper(index, 'outbound')"
>
出库
</view>
<view
v-else-if="steps[index].length > 0 && steps[index][steps[index].length - 1].desc == '未完成'"
class="button-item"
@click="operatePaper(index, 'send')"
>
发货
<view v-if="orderInfo.status == supplierOrderStatusEnum.WAIT_DELIVERY">
<view v-if="steps[index].length > 0 && steps[index][0].desc == '未完成'" class="button-item" @click="operatePaper(index, 'cut')">分切</view>
<view
v-else-if="steps[index].length > 0 && steps[index][steps[index].length - 2].desc == '未完成'"
class="button-item"
@click="operatePaper(index, 'outbound', 1000)"
>
出库
</view>
<view
v-else-if="steps[index].length > 0 && steps[index][steps[index].length - 1].desc == '未完成'"
class="button-item"
@click="operatePaper(index, 'send')"
>
发货
</view>
</view>
</view>
<view class="order-row flex-row-center-space">
@ -66,7 +68,7 @@
<uni-steps
:options="steps[index]"
active-color="#1890FF"
:active="order.outboundProcessList.length > 0 ? order.outboundProcessList.length : -1"
:active="order.outboundProcessList.length > 0 ? order.outboundProcessList.length - 1 : -1"
></uni-steps>
</view>
</view>
@ -80,6 +82,10 @@
</view>
</view>
<view class="imgs flex-row-start-start">
<view class="default-upload" @click="uploadVoucher()">
<image src="/static/imgs/order/camera.png" class="icon"></image>
<text style="font-size: 26rpx; color: #4c4a58">上传凭证</text>
</view>
<image style="width: 120rpx; height: 120rpx; margin-right: 12rpx" src=""></image>
</view>
</view>
@ -129,17 +135,25 @@
<qn-footer fixed height="120rpx" v-if="orderInfo.status === supplierOrderStatusEnum.WAIT_DELIVERY">
<view class="flex-row-center-space" style="padding: 0 32rpx">
<view class="button button_cancel" style="width: 220rpx" @click="cancel">取消订单</view>
<view class="button button_contact">查看合同</view>
<view class="button button_confirm" style="width: 220rpx">确认发货</view>
<view class="button button_contact" @click="viewContract">查看合同</view>
<view class="button button_confirm" @click="delivery" style="width: 220rpx">确认发货</view>
</view>
</qn-footer>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import { getSupplierOrderDetail, cancelSupplierOrder, confirmSupplierOrder } from '@/apis/orderApi.js'
import { go2, back, uploadImage } from '@/utils/hook.js'
import {
getSupplierOrderDetail,
cancelSupplierOrder,
confirmSupplierOrder,
supplierOperatePaper,
supplierUploadVoucher,
supplierDelivery
} from '@/apis/orderApi.js'
import { supplierOrderStatusMap, supplierOrderStatusEnum } from '@/enums/index.js'
import { transformFileToImg } from '@/apis/commonApi.js'
export default {
data() {
return {
@ -319,14 +333,108 @@ export default {
if (res.confirm) {
confirmSupplierOrder({
orderId: order.orderId
}).then((res) => {
if (res) {
if (res) {
// #ifdef APP-PLUS
go2('page-view', { title: '供应商订单签约', url: encodeURIComponent(res.signUrl), params: this.params })
// #endif
// #ifdef H5
window ? (window.location.href = res.signUrl) : ''
// #endif
}
// uni.showToast({
// title: '',
// icon: 'success',
// success: () => {
// setTimeout(() => {
// this.init(order.orderId)
// }, 1000)
// }
// })
}
})
}
}
})
},
// cut: outbound: send:
operatePaper(index, type, quantity) {
const map = {
cut: 30301,
outbound: 30302,
send: 30303
}
let target = this.orderInfo.orderItems[index]
supplierOperatePaper({
quantity: quantity || target.pieceQuantity,
supplierOderItemId: target.supplierOderItemId,
status: map[type]
}).then((res) => {
if (res) {
uni.showToast({
title: '操作成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
}
})
},
//
uploadVoucher() {
uploadImage(['album'], 5)
.then((urls) => {
if (urls) {
let promiseList = []
urls.forEach((url) => {
promiseList.push(
supplierUploadVoucher({
supplierOrderId: this.orderInfo.orderId,
proofDeliveryUrl: url
})
)
})
Promise.all(promiseList).then(() => {
uni.showToast({
title: '上传成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
})
}
})
.catch((e) => {
uni.showToast({
title: '上传失败',
icon: 'fail'
})
})
},
//
delivery() {
uni.showModal({
title: '提示',
content: '确定确认送货吗?',
success: (res) => {
if (res.confirm) {
supplierDelivery({
supplierOrderId: this.orderInfo.orderId
}).then((res) => {
if (res) {
uni.showToast({
title: '确认订单成功',
title: '确认送货成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(order.orderId)
this.init(this.orderInfo.orderId)
}, 1000)
}
})
@ -336,8 +444,15 @@ export default {
}
})
},
// cut: outbound: send:
operatePaper(index, type) {},
//
viewContract() {
let url = this.orderInfo.contractUrl
if (url) {
transformFileToImg({ fileUrl: url }).then((res) => {
uni.previewImage({ urls: [res.imgUrl], current: res.imgUrl })
})
}
},
clip(content) {
uni.setClipboardData({
data: content,
@ -460,4 +575,19 @@ export default {
color: #007aff;
margin: 0 14rpx;
}
.default-upload {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
background-color: #dcdee0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.icon {
width: 56rpx;
height: 56rpx;
margin-bottom: 8rpx;
}
}
</style>

6
pages/page-view/index.vue

@ -37,7 +37,13 @@ export default {
})
},
methods: {
/**
* @param {Object} data {data:{},type:''}
*/
getMessage(data) {
if (data.type == 'zzgSupplierTCSignSuccess') {
go2('order-detail', { orderId: data.data.orderId }, true)
}
//
if (data.type == 'signSuccess') {
// go2('paper-mall-order-detail', { id: data.orderId }, true)

4
static/icon/iconfont.css

@ -11,6 +11,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-Less:before {
content: "\e734";
}
.icon-m_dow_arrow:before {
content: "\e600";
}

BIN
static/icon/iconfont.ttf

BIN
static/imgs/order/camera.png

Before After
Width: 56  |  Height: 56  |  Size: 1.7 KiB

4
utils/hook.js

@ -100,7 +100,7 @@ export function exit() {
export function uploadImage(sourceType = ['album', 'camera'], count = 1) {
return new Promise((resolve, reject) => {
uni.chooseImage({
count: 1,
count: count,
sizeType: ['original', 'compressed'],
sourceType: sourceType,
success: (res) => {
@ -141,7 +141,7 @@ export function uploadFile(path, type = 'image') {
let result = JSON.parse(res.data)
if (result.data) {
resolve(result.data)
return result.data
return result.data
} else {
reject(result.message)
}

3
utils/http/http.js

@ -53,6 +53,9 @@ export default class Http {
method: conf.method,
success: (res) => {
let data = resInterceptor(res, opt)
if (env === 'test') {
console.log('报错的请求参数:', conf)
}
// 服务器错误也会用then抛出,需要自己判断data==null
resolve(data)
},

9
utils/http/index.js

@ -8,7 +8,8 @@ const xappid = '503258978847966403'
const prefixList = {
'/yyt-uec': `https://api-client-yyt${urlEnv}.qniao.cn`,
'/base-paper-trading': `https://api-client-yyt${urlEnv}.qniao.cn`,
'/uec': `https://api-client-uec${urlEnv}.qniao.cn`
'/uec': `https://api-client-uec${urlEnv}.qniao.cn`,
'/document': `https://api-ops-yyt${urlEnv}.qniao.cn`
}
const config = {
@ -87,12 +88,18 @@ const resInterceptor = (response, options) => {
title: res.message,
icon: 'none'
})
if (env === 'test') {
console.log('报错的返回信息:', response)
}
return null
}
} else {
uni.showToast({
title: '服务器错误,请联系客服'
})
if (env === 'test') {
console.log('服务器错误的返回信息:', response)
}
// 后期可以加记录
return null
}

14
utils/index.js

@ -50,16 +50,16 @@ export const makeSocket = async ({ pageInfo = '', retry = false }) => {
async function createSocket() {
let url = ''
// if (env == 'production') {
// url = 'wss://api-client-yyt.qniao.cn/qn-websocket-service/wechatwebsock?token='
// } else if (env == 'test') {
// url = 'wss://api-client-yyt-test.qniao.cn/qn-websocket-service/wechatwebsock?token='
// }
if (env == 'production') {
url = 'wss://api-client-yyt.qniao.cn/trading-center/wechatwebsock?token='
url = 'wss://api-client-yyt.qniao.cn/qn-websocket-service/wechatwebsock?token='
} else if (env == 'test') {
url = 'wss://api-client-yyt-test.qniao.cn/trading-center/wechatwebsock?token='
url = 'wss://api-client-yyt-test.qniao.cn/qn-websocket-service/wechatwebsock?token='
}
// if (env == 'production') {
// url = 'wss://api-client-yyt.qniao.cn/trading-center/wechatwebsock?token='
// } else if (env == 'test') {
// url = 'wss://api-client-yyt-test.qniao.cn/trading-center/wechatwebsock?token='
// }
const token = store.state.qnToken
const socketTask = await uni.connectSocket({
url: `${url}${token}`,

Loading…
Cancel
Save