Browse Source

确认订单

devlop
邓雄飞 4 years ago
parent
commit
148020191d
16 changed files with 511 additions and 24 deletions
  1. 8
      apis/commonApi.js
  2. 36
      apis/orderApi.js
  3. 58
      pages.json
  4. 6
      pages/enterprise-info/index.vue
  5. 2
      pages/login/index.vue
  6. 20
      pages/order-detail/index.vue
  7. 10
      pages/order-list/index.vue
  8. 393
      pages/order-make/index.vue
  9. BIN
      static/imgs/order/address-icon.png
  10. BIN
      static/imgs/order/edit-address-icon.png
  11. BIN
      static/imgs/order/fs-pay-icon.png
  12. BIN
      static/imgs/order/month-pay-icon.png
  13. BIN
      static/imgs/order/right-arrow.png
  14. BIN
      static/imgs/order/select-icon.png
  15. BIN
      static/imgs/order/selected-icon.png
  16. 2
      utils/hook.js

8
apis/commonApi.js

@ -88,3 +88,11 @@ export function getGuaranteeContract(data = {}) {
export function getFsCredit(data = {}) {
return http.get({ url: '/yyt-uec/credit/get/enterprise-feisuan-credit', data })
}
/**
* 获取当前账号企业的被担保的月结额度
* @param {object} data 参数 enterpriseId supplierId
*/
export function getMonthCredit(data = {}) {
return http.get({ url: '/yyt-uec/customer/get/supplier-credit', data })
}

36
apis/orderApi.js

@ -12,3 +12,39 @@ export const getOrderList = (data) => {
data
})
}
/**
* 获取待确认订单详情
* @param {object} data customerOrderIduserId
* @returns {Promise<object[]>}
*/
export const getPreOrderInfo = (data) => {
return http.get({
url: '/base-paper-trading/get/customer/to/be/confirmed/order',
data
})
}
/**
* 获取企业默认收货地址
* @param {object} data enterpriseId
* @returns {Promise<object[]>}
*/
export const getDefaultAddress = (data) => {
return http.get({
url: '/uec/get/default-enterprise-shipping-address',
data
})
}
/**
* 确认订单
* @param {object} data
* @returns {Promise<object>}
*/
export const submitClientOrder = (data) => {
return http.post({
url: '/base-paper-trading/customer/submit/order',
data
})
}

58
pages.json

@ -75,6 +75,22 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/order-make/index",
"style": {
"navigationBarTitleText": "创建订单",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/order-detail/index",
"style": {
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/test/index",
"style": {
@ -83,27 +99,27 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/paper-details/index",
"style": {
"navigationBarTitleText": "纸品详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/for-comparison/index",
"style": {
"navigationBarTitleText": "实单询比价",
"enablePullDownRefresh": false
}
},
{
"path": "pages/add-address-manage/index",
"style": {
"navigationBarTitleText": "新建收货地址",
"enablePullDownRefresh": false
}
}
{
"path": "pages/paper-details/index",
"style": {
"navigationBarTitleText": "纸品详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/for-comparison/index",
"style": {
"navigationBarTitleText": "实单询比价",
"enablePullDownRefresh": false
}
},
{
"path": "pages/add-address-manage/index",
"style": {
"navigationBarTitleText": "新建收货地址",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",

6
pages/enterprise-info/index.vue

@ -229,6 +229,8 @@ export default {
locDistrictName: null,
locStreetName: null,
locDetail: null,
regAddrLongitude: null,
regAddrLatitude: null,
legalPersonName: null,
legalPersonMobile: null,
legalPersonIdCardNo: null,
@ -292,6 +294,8 @@ export default {
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()
},
showCompany(e) {
@ -334,6 +338,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) {

2
pages/login/index.vue

@ -139,7 +139,7 @@ export default {
store.commit('setToken', token)
//
const nextPage = store.state.nextPage
let page = null
let page = undefined
if (nextPage.name) {
page = { url: nextPage.name, data: nextPage.data, isRedirect: true }
}

20
pages/order-detail/index.vue

@ -0,0 +1,20 @@
<template>
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="订单详情"></uni-nav-bar>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
export default {
data() {
return {}
},
methods: {
go2,
back
}
}
</script>
<style lang="scss" scoped></style>

10
pages/order-list/index.vue

@ -13,7 +13,7 @@
</view>
<view class="list-area">
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback">
<view v-for="item in list" :key="item.orderId" class="order-area">
<view v-for="item in list" :key="item.orderId" class="order-area" @click="goDetail(item)">
<view class="order-header">
<view class="left">
<text style="font-size: 30rpx; color: #000000; font-weight: 600">{{ item.orderId }}</text>
@ -143,6 +143,14 @@ export default {
result += `/${target.pieceQuantity}`
}
return result
},
//
goDetail(order) {
if (order.status === orderStatusEnum.WAIT_CONFIRM) {
go2('order-make', { orderId: order.orderId })
} else {
go2('order-detail', { orderId: order.orderId })
}
}
},
onLoad(option) {

393
pages/order-make/index.vue

@ -0,0 +1,393 @@
<template>
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="订单确认"></uni-nav-bar>
<view class="address-area">
<view class="header">
<image class="img" src="/static/imgs/order/address-icon.png"></image>
<text class="text">{{ orderInfo.customerEnterpriseName }}</text>
</view>
<!-- 送货地址 -->
<view class="address-content" v-if="deliveryAddress.addressId" @click="go2('address-manage', { operation: 'select' })">
<view class="left">
<image style="width: 66rpx; height: 66rpx" src="/static/imgs/order/address-icon.png"></image>
<text style="font-size: 22rpx; margin-top: 8rpx; transform: scale(0.8)">送货至</text>
</view>
<view class="center">
<text style="font-size: 30rpx; font-weight: 600">{{ `${deliveryAddress.receiver} ${deliveryAddress.receiverMobile}` }}</text>
<text style="font-size: 28rpx; font-weight: 500; word-break: break-all; margin-top: 10rpx; line-height: 1.2">
{{
`${deliveryAddress.provinceName}${deliveryAddress.cityName}${deliveryAddress.districtName}${deliveryAddress.streetName}${deliveryAddress.detail}`
}}
</text>
</view>
<image class="right" src="/static/imgs/order/edit-address-icon.png"></image>
</view>
<view class="address-content" v-else @click="go2('address-manage', { operation: 'select' })">
<view class="left">
<image style="width: 66rpx; height: 66rpx" src="/static/imgs/order/address-icon.png"></image>
</view>
<view class="center">
<text style="font-size: 30rpx; font-weight: 400">请添加收货地址</text>
</view>
<image class="right" src="/static/imgs/order/right-arrow.png"></image>
</view>
</view>
<!-- 商品信息区域 -->
<view class="order-area">
<view v-for="item in orderInfo.supplierOrder" :key="item.supplierOrderId">
<view class="header">
<text style="font-size: 32rpx; font-weight: 600">{{ item.supplierEnterpriseName }}</text>
</view>
<view v-for="order in item.orderItems" :key="order.supplierOderItemId">
<view class="order-header">
<text style="font-size: 30rpx; font-weight: 600">
{{ `${order.brandName}${order.productName} | ${order.gramWeight}g | ${order.width}*${order.length} | ${order.pieceQuantity}` }}
</text>
</view>
<view class="order-row">
<text>重量():</text>
<text>{{ order.buyTon }}</text>
</view>
<view class="order-row">
<text>单价(/):</text>
<text>{{ order.unitPrice }}</text>
</view>
<view class="order-row">
<text>小计():</text>
<text>{{ order.subtotal }}</text>
</view>
<view class="order-row">
<qn-easyinput
style="background-color: #f7f8fa; border-radius: 10rpx; padding: 8rpx 0rpx; font-size: 28rpx; color: #888888; height: 88rpx"
v-model="order.remark"
placeholder="请输入备注"
:inputBorder="false"
:maxlength="100"
></qn-easyinput>
</view>
</view>
</view>
</view>
<!-- 送货时间 -->
<view class="timer-area">
<text style="font-size: 30rpx; color: #000000">送货时间:</text>
<qn-datetime-picker v-model="orderInfo.receivedTime" type="datetime" :border="false"></qn-datetime-picker>
</view>
<!-- 支付方式 -->
<view class="pay-area">
<view class="pay-item">
<view class="left">
<image class="img" src="/static/imgs/order/month-pay-icon.png"></image>
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用月结额度</text>
<text v-if="payMap['month'] != null" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['month'].availableCreditLine }}</text>
</view>
<image
v-if="payMap['month'] != null"
@click="selectPayMethod('month')"
class="img"
:src="currentPayType == 'month' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'"
></image>
<text v-else style="font-size: 28rpx; color: #888888">待申请</text>
</view>
<view class="pay-item" style="border: none">
<view class="left">
<image class="img" src="/static/imgs/order/fs-pay-icon.png"></image>
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用飞算资金</text>
<text v-if="payMap['fs'] != null" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['fs'].availableCreditLine }}</text>
</view>
<image
v-if="payMap['fs'] != null"
@click="selectPayMethod('month')"
class="img"
:src="currentPayType == 'fs' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'"
></image>
<text v-else style="font-size: 28rpx; color: #888888">待申请</text>
</view>
</view>
<qn-footer fixed height="120rpx">
<view class="button-area">
<view class="text-line">
<text style="font-size: 28rpx">应付:</text>
<text style="font-size: 40rpx; color: #f5222d">{{ orderInfo.totalOfferPrice }}</text>
</view>
<view class="button" @click="submitOrder">确认下单</view>
</view>
</qn-footer>
</view>
</template>
<script>
import { go2, back, getCache } from '@/utils/hook.js'
import { getPreOrderInfo, getDefaultAddress, submitClientOrder } from '@/apis/orderApi'
import { getFsCredit, getMonthCredit } from '@/apis/commonApi'
import { isObject } from '@/utils/is'
export default {
data() {
return {
orderInfo: {
customerEnterpriseName: '',
receivedTime: null
},
deliveryAddress: {},
currentPayType: '',
payMap: {
month: {
availableCreditLine: 0,
value: 2
},
fs: {
availableCreditLine: 0,
value: 4
}
}
}
},
onLoad(option) {
if (option.orderId) {
getPreOrderInfo({
customerOrderId: option.orderId
}).then((res) => {
if (res) {
this.orderInfo = res
}
})
} else {
uni.showToast({
title: '订单信息错误',
icon: 'warn',
success: () => {
setTimeout(() => {
back()
}, 2000)
}
})
}
},
created() {
this.init()
},
onShow() {
let address = getCache('address')
if (address) {
this.deliveryAddress = address
this.deliveryAddress.addressId = address.id
}
},
methods: {
go2,
back,
selectPayMethod(type) {
this.currentPayType = type
},
submitOrder() {
if (this.currentPayType == null) {
uni.showToast({
title: '请选择支付方式',
icon: 'none'
})
return
}
let itemsRemarkList = []
//
for (let i = 0; i < this.orderInfo.supplierOrder.length; i++) {
this.orderInfo.supplierOrder[i].orderItems.forEach((item) => {
itemsRemarkList.push({ customerOderItemId: item.customerOderItemId, remark: item.remark })
})
}
submitClientOrder({
deliveryAddress: this.deliveryAddress,
itemsRemarkList,
orderId: this.orderInfo.orderId,
paymentMethod: this.payMap[this.currentPayType].value,
receivedTime: this.orderInfo.receivedTime
})
},
init() {
//
getMonthCredit({
enterpriseId: this.$store.state.companyInfo.id,
supplierId: this.$store.state.supplierId
}).then((res) => {
if (res) {
if (res.supplierCredit !== null) {
this.payMap['month'].availableCreditLine = res.supplierCredit
} else {
this.payMap['month'] = null
}
} else {
this.payMap['month'] = null
}
})
//
getFsCredit({
enterpriseId: this.$store.state.companyInfo.id
}).then((res) => {
if (isObject(res)) {
this.payMap['fs'].availableCreditLine = res.availableCreditLine
} else {
this.payMap['fs'] = null
}
})
//
getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
if (res) {
this.deliveryAddress = res
this.deliveryAddress.addressId = res.id
}
})
}
}
}
</script>
<style lang="scss" scoped>
.address-area {
width: 750rpx;
padding: 0 32rpx;
background-color: #fff;
.header {
width: 686rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
padding: 24rpx 0 40rpx;
border-bottom: 2rpx solid #dddddd;
.img {
width: 100rpx;
height: 100rpx;
flex-grow: 0;
flex-shrink: 0;
margin-right: 20rpx;
}
.text {
font-size: 30rpx;
color: #333333;
font-weight: 600;
}
}
.address-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
.left {
width: 72rpx;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
flex-grow: 0;
flex-shrink: 0;
}
.center {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
flex-grow: 1;
flex-shrink: 1;
margin: 0 38rpx 0 24rpx;
}
.right {
width: 40rpx;
height: 40rpx;
flex-grow: 0;
flex-shrink: 0;
}
}
}
.order-area {
width: 750rpx;
background-color: #fff;
padding-bottom: 14rpx;
.header {
width: 750rpx;
height: 88rpx;
background-color: #e5f1ff;
padding: 24rpx 32rpx;
}
.order-header {
width: 750rpx;
padding: 24rpx 32rpx;
border-bottom: 2rpx dashed #d8d8d8;
margin-bottom: 20rpx;
}
.order-row {
width: 750rpx;
padding: 0 32rpx;
margin-bottom: 18rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #555555;
}
}
.timer-area {
margin-top: 20rpx;
width: 750rpx;
padding: 0rpx 32rpx;
height: 88rpx;
background-color: #fff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
text-align: right;
}
.pay-area {
background-color: #fff;
margin-top: 20rpx;
.pay-item {
width: 750rpx;
padding: 20rpx 32rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #d8d8d8;
.left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.img {
width: 40rpx;
height: 40rpx;
flex-grow: 0;
flex-shrink: 0;
}
}
}
.button-area {
width: 750rpx;
height: 88rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 32rpx;
.text-line {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.button {
width: 320rpx;
height: 88rpx;
border-radius: 48rpx;
background-color: #007aff;
font-size: 36rpx;
font-weight: 500;
color: #fff;
text-align: center;
line-height: 88rpx;
}
}
</style>

BIN
static/imgs/order/address-icon.png

Before After
Width: 66  |  Height: 66  |  Size: 4.5 KiB

BIN
static/imgs/order/edit-address-icon.png

Before After
Width: 40  |  Height: 40  |  Size: 949 B

BIN
static/imgs/order/fs-pay-icon.png

Before After
Width: 40  |  Height: 40  |  Size: 1.2 KiB

BIN
static/imgs/order/month-pay-icon.png

Before After
Width: 40  |  Height: 40  |  Size: 903 B

BIN
static/imgs/order/right-arrow.png

Before After
Width: 32  |  Height: 32  |  Size: 604 B

BIN
static/imgs/order/select-icon.png

Before After
Width: 32  |  Height: 32  |  Size: 929 B

BIN
static/imgs/order/selected-icon.png

Before After
Width: 40  |  Height: 40  |  Size: 1.5 KiB

2
utils/hook.js

@ -156,7 +156,7 @@ export function uploadFile(path, type = 'image') {
/**
* 根据类型获取缓存
* @param {string} type 缓存类型
* @returns 缓存数据
* @returns object 缓存数据
*/
export function getCache(type) {
let data = null

Loading…
Cancel
Save