master
wangchenguang 2 years ago
parent 08bce81031
commit 5d86d49479
  1. 4
      config/request.js
  2. 19
      order/editCourse/editCourse.vue
  3. 254
      order/orderDetail/orderDetail.vue
  4. 2
      order/orders/orders.vue
  5. 10
      pages/clientDetail/clientDetail.vue
  6. 2
      pages/clients/clients.vue
  7. BIN
      static/image/edit.png

@ -5,9 +5,9 @@
*/
export default {
baseURL: 'https://huorantech.cn/',
// baseURL: 'https://huorantech.cn/',
// baseURL: 'http://192.168.31.151:9000/',
// baseURL: 'http://121.37.12.51/',
baseURL: 'http://121.37.12.51/',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},

@ -18,7 +18,7 @@
<view class="name">产品类型</view>
<view class="val">{{ productTypes.find(e => e.id === item.productType).name }}</view>
</view>
<view :class="['line req', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]">
<view :class="['line', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]">
<view class="name">使用期限</view>
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" :disabled="isEdit" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')">
<view v-if="isEdit">{{ units.find(e => e.id === item.options).text }}</view>
@ -118,7 +118,7 @@
courses: {} , //
orderRepeat: [],
repeatMsg: '',
err: ''
err: '',
}
},
onShow() {
@ -163,6 +163,21 @@
courses.data.list.push(e)
})
// let selectData= []
// let itemIndex = ''
// for (let item in courses) {
// if(courses[item].list.length) {
// const data = courses[item].list.find(options=>{
// if(options.id == this.editId) {
// itemIndex = item
// }
// return options.id == this.editId
// })
// selectData.push(data)
// break
// }
// }
// courses[itemIndex].list = selectData
this.courses = courses
try {
uni.removeStorageSync('courses')

@ -63,7 +63,8 @@
<view class="l-title">{{ c.name }}</view>
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons>
<ul class="pro-list" v-show="!c.shrink">
<li v-for="(item, i) in c.list" :key="i" @click.stop="editCourse(c, i)">
<!-- <li v-for="(item, i) in c.list" :key="i" @click.stop="editCourse(c, i)"> -->
<li v-for="(item, i) in c.list" :key="i">
<view class="name">
<view class="left">
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image>
@ -78,18 +79,44 @@
<image v-if="!orderId || isRenew" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image>
</view>
</view>
<view class="info">
<view class="line">
<view class="label">起始日期</view>
<!-- <view class="val">{{ item.startTime + (item.endTime && ' - ' + item.endTime) }}</view> -->
<view v-if="!isHandle">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view>
<uni-datetime-picker v-else type="date" v-model="item.startTime" :border="false" @change="calcDate(item)">
<view :class="['ph', {val: item.startTime}]">
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
</view>
</uni-datetime-picker>
</view>
<view class="line" :class="[ {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]">
<view class="label">使用期限</view>
<view class="val">{{ item.startTime + (item.endTime && ' - ' + item.endTime) }}</view>
<input v-if="isHandle" class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" :disabled="!isHandle" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')">
<view v-if="!isHandle" class="defaultBox">{{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}</view>
<view v-else class="val unit" @click="selectUnit(item)">
<text>{{ units.find(e => e.id === item.options).text }}</text>
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image>
</view>
</view>
<view :class="['line req', {err: err === 'accountNum' + item.dataOrCourseId + item.authority}]">
<view class="label">数量</view>
<view v-if="item.authority" class="val">1</view>
<input v-else type="number" v-model="item.accountNum" placeholder="请输入账号数量" @input="calcFinalPrice(item)" @change="handleErr(item, 'accountNum')">
</view>
<view class="line">
<view class="label">市场价</view>
<view class="label">{{ item.authority ? '市场价' : '市场单价' }}</view>
<view class="val">{{ item.marketValue || 0 }}</view>
</view>
<view class="line">
<view class="label">结算价</view>
<view class="val">{{ item.settlementPrice }}</view>
<view v-if="!isHandle" class="defaultBox">{{ item.settlementPrice }}</view>
<view class="inline" v-else>
<input type="number" v-model="item.settlementPrice" placeholder="请输入" @change="handleErr(item, 'settlementPrice')" @input="updateServiceFee(item)">
</view>
</view>
<view class="line">
<view class="label">折扣率</view>
@ -99,9 +126,13 @@
<view class="label">平台服务费</view>
<view class="val">{{ item.serviceFee }}</view>
</view>
<view class="line done">
<view class="val">成交价格</view>
<view class="price">{{ item.finalPrice }}</view>
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]">
<view class="label">成交价</view>
<view v-if="!isHandle" class="defaultBox">{{ item.finalPrice }}</view>
<view class="inline" v-else>
<input type="number" v-model="item.finalPrice" placeholder="请输入" :disabled="isEdit && !item.authority" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')">
</view>
</view>
</view>
</li>
@ -142,11 +173,11 @@
<view v-if="isDetail" class="action">
<template v-if="form.isDel !== 1">
<template v-if="form.orderStatus === 1">
<view class="item" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=edit`)">
<view class="item" v-if="auth('订单管理:修改')" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=edit`)">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons>
<view class="text">修改</view>
</view>
<view class="item" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=renew`)">
<view class="item" v-if="auth('订单管理:续费')" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=renew`)">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="30" color="#959595"></uni-icons>
<view class="text">续费</view>
</view>
@ -178,6 +209,7 @@
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js'
import { add, update, del, getDetail, renew, ship, miniProgramOrderRecord, bulkShipping } from '@/apis/modules/order.js'
import { teamList, getAllTeam } from '@/apis/modules/parner.js'
import { getOrderOtherTime } from '@/apis/modules/order.js'
export default {
data() {
return {
@ -193,6 +225,7 @@
text: '试用',
value: 2
}],
form: {
businessManagerId: '',
businessManagerName: '',
@ -234,6 +267,18 @@
customerListAll: [],
err: '',
promises: [],
orderRepeat:[],
units: [{
text: '日',
id: 0
}, {
text: '月',
id: 1
}, {
text: '年',
id: 2
}],
unitText: ['日', '月', '年'],
}
},
watch: {
@ -675,6 +720,158 @@
uni.hideLoading()
})
}
},
calcDate(row, fromData) {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
const { periodOfUse, options } = row
let optionsData = 0
if (periodOfUse) {
if (options == 1){
optionsData = periodOfUse === '12' ? 31536000000 : periodOfUse*30*24*60*60*1000
} else if (options == 2){
optionsData = periodOfUse*365*24*60*60*1000
} else {
optionsData = periodOfUse*24*60*60*1000
}
}
let time = new Date(row.startTime).getTime()
let endTime = time + optionsData
row.endTime = time + optionsData
let dt = new Date(endTime)
row.endTime = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate())
let endYear = endTime - time
let endYears = endYear/1000/60/60/24
row.remainingPeriod = endYears
const unit = row.options // 使
const useUnit = row.periodOfUse // 使
//
const price = row.marketPrice //
// //365,/12)
row.marketValue = (!unit ?
price / 365 * useUnit :
unit === 1 ?
price / 12 * useUnit :
price * useUnit).toFixed(2)
this.dealSettlePrice(row)
// +1
if (!fromData) {
const cId = row.dataOrCourseId
const date = new Date(row.startTime)
const orderRepeat = this.orderRepeat
getOrderOtherTime({
customerId: this.customerId,
id: cId,
startTime: this.$util.formatDate(date, 'yyyy-MM-dd'),
endTime: row.endTime
}).then(res => {
orderRepeat.includes(cId) && orderRepeat.splice(orderRepeat.findIndex(e => e === cId), 1)
if (res.endTime) {
let time = new Date(res.endTime)
time = new Date(time.setDate(time.getDate() + 1))
row.startTime = this.$util.formatDate(time, 'yyyy-MM-dd')
}
}).catch(res => {
this.repeatMsg = res.message
orderRepeat.includes(cId) || orderRepeat.push(cId)
})
}
//
this.calcDiscount(row)
}, 500)
},
dealSettlePrice(row) {
// 0
if (this.orderType == 2) {
row.settlementPrice = 0
row.serviceFee = 0
} else {
const unit = row.options // 使
const useUnit = row.periodOfUse // 使
let sPrice = ''
if (row.settlementMethod == 0) {
// **/**(1)
const priceUnit = row.settlementPriceUnit
sPrice = ((!unit ?
priceUnit / 365 * useUnit :
unit === 1 ?
priceUnit / 12 * useUnit :
priceUnit * useUnit) * (row.authority ?
1 :
row.accountNum)).toFixed((2))
} else {
// *
sPrice = (row.finalPrice * row.businessProportion / 100).toFixed((2))
}
row.settlementPrice = this.$util.handleNaN(sPrice)
// *10%
console.log('row.settlementPrice =>' ,row.settlementPrice)
if (row.settlementPrice) {
console.log(2222)
row.serviceFee = (row.settlementPrice * 0.1).toFixed(2)
}else {
console.log(1111111)
row.serviceFee = 0
}
}
},
calcDiscount(row) {
const price = row.authority ? row.finalPrice : row.finalValue
const { marketValue } = row
// (-)÷ x100%
if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%'
},
selectUnit(item) {
const that = this
uni.showActionSheet({
title: '标题',
itemList: that.unitText,
success: ({ tapIndex }) => {
item.options = tapIndex
that.calcDate(item)
}
})
},
// ////
calcFinalValue(row) {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
const { authority, periodOfUse, options, accountNum, finalPrice } = row
if (!authority && periodOfUse && accountNum && finalPrice) {
row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2)
}
//
this.calcDiscount(row)
this.dealSettlePrice(row)
}, 500)
},
// **//
calcFinalPrice(row) {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
const { finalValue, accountNum, periodOfUse, finalPrice } = row
if (periodOfUse) {
if (accountNum) {
// =**
if (finalValue) {
row.finalPrice = Math.round(finalValue * periodOfUse * accountNum)
} else if (!finalValue && finalPrice) {
// =//
row.finalValue = (finalPrice / periodOfUse / accountNum).toFixed(2)
this.calcDiscount(row)
}
} else if (finalValue && finalPrice && !row.authority) {
// =//
row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue)
}
}
this.dealSettlePrice(row)
}, 500)
},
//
updateServiceFee(options) {
options.serviceFee = (options.settlementPrice * 0.1).toFixed(2)
console.log('options===>',options)
}
}
}
@ -715,6 +912,7 @@
.left {
display: inline-flex;
align-items: center;
max-width: 480rpx;
}
.course-action {
display: inline-flex;
@ -865,4 +1063,42 @@
background-color: #007EFF;
}
}
.unit {
display: inline-flex;
align-items: center;
.icon {
width: 28rpx;
margin-left: 20rpx;
}
input {
font-size: 28rpx;
}
text{
font-size: 28rpx;
}
}
.line {
.inline {
display: flex;
align-items: center;
font-size: 28rpx;
input {
text-align: right;
margin-right: 10rpx;
margin-left: 20rpx;
color: #333;
}
}
}
.period{
display: inline-block;
text-align: right;
margin-right: 10rpx;
margin-left: 20rpx;
color: #333;
width: 60%;font-size: 28rpx;
}
.defaultBox {
font-size: 28rpx;
}
</style>

@ -51,7 +51,7 @@
</template>
<empty v-else></empty>
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../orderDetail/orderDetail')"></uni-icons>
<uni-icons v-if="auth('订单管理:新建订单')" class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../orderDetail/orderDetail')"></uni-icons>
<filter-popup :data="filterData" :form.sync="filterForm" showArea v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
</view>
</template>

@ -71,7 +71,7 @@
</view>
<view v-if="isDetail" class="action">
<view class="item" @click="toPage(`../clientDetail/clientDetail?customerId=${customerId}`)">
<view class="item" v-if="auth('客户管理:编辑')" @click="toPage(`../clientDetail/clientDetail?customerId=${customerId}`)">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons>
<view class="text">编辑</view>
</view>
@ -355,4 +355,12 @@
margin-right: 10rpx;
}
}
.editIcon {
width: 50rpx;
height: 50rpx;
margin-left: 20rpx;
image{
width: 100%;height: 100%
}
}
</style>

@ -33,7 +33,7 @@
</template>
<empty v-else text="您当前暂无有下单的客户,请快去给客户下订单吧"></empty>
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../clientDetail/clientDetail')"></uni-icons>
<uni-icons class="plus" v-if="auth('客户管理:新增')" type="plus-filled" size="60" color="#007eff" @click="$util.to('../clientDetail/clientDetail')"></uni-icons>
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
</view>
</template>

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Loading…
Cancel
Save