|
|
@ -80,7 +80,7 @@ |
|
|
|
<button v-if="item.status === 1 || isHandle || !orderId && auth('订单管理:发货')" class="course-btn" type="primary" @click.stop="handleDeliver(n, i)">{{ item.ship ? '取消' : ''}}发货</button> |
|
|
|
<button v-if="item.status === 1 || isHandle || !orderId && auth('订单管理:发货')" class="course-btn" type="primary" @click.stop="handleDeliver(n, i)">{{ item.ship ? '取消' : ''}}发货</button> |
|
|
|
<button v-else-if="!isDetail && auth('订单管理:启用')" class="course-btn" type="primary" @click.stop="handleEnable(n, i)">{{ item.isEnable ? '禁用' : '启用'}}</button> |
|
|
|
<button v-else-if="!isDetail && auth('订单管理:启用')" class="course-btn" type="primary" @click.stop="handleEnable(n, i)">{{ item.isEnable ? '禁用' : '启用'}}</button> |
|
|
|
<image v-if="!orderId || isRenew" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image> |
|
|
|
<image v-if="!orderId || isRenew" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image> |
|
|
|
<button v-if="(item.authority == 3 || item.authority == 4) && ((item.mallNonAssociatedLinks && item.mallNonAssociatedLinks.length) || item.shipContent)" class="course-btn" type="primary" @click.stop="showShip(item)">发货信息</button> |
|
|
|
<button v-if="(item.authority == 3 || item.authority == 4) && ((item.mallNonAssociatedLinks && item.mallNonAssociatedLinks.length) || item.shipContent)" class="course-btn mg" type="primary" @click.stop="showShip(item)">发货信息</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
@ -88,7 +88,7 @@ |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="label">起始日期</view> |
|
|
|
<view class="label">起始日期</view> |
|
|
|
<!-- <view class="val">{{ item.startTime + (item.endTime && ' - ' + item.endTime) }}</view> --> |
|
|
|
<!-- <view class="val">{{ item.startTime + (item.endTime && ' - ' + item.endTime) }}</view> --> |
|
|
|
<view v-if="!isHandle">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view> |
|
|
|
<view v-if="isDetail || isEdit">{{ 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)"> |
|
|
|
<uni-datetime-picker v-else type="date" v-model="item.startTime" :border="false" @change="calcDate(item)"> |
|
|
|
<view :class="['ph', {val: item.startTime}]"> |
|
|
|
<view :class="['ph', {val: item.startTime}]"> |
|
|
|
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} |
|
|
|
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} |
|
|
@ -97,8 +97,8 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line" :class="[ {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> |
|
|
|
<view class="line" :class="[ {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> |
|
|
|
<view class="label">使用期限</view> |
|
|
|
<view class="label">使用期限</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')"> |
|
|
|
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" :disabled="isDetail || isEdit" @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-if="isDetail || isEdit" class="defaultBox">{{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}</view> |
|
|
|
|
|
|
|
|
|
|
|
<view v-else class="val unit" @click="selectUnit(item)"> |
|
|
|
<view v-else class="val unit" @click="selectUnit(item)"> |
|
|
|
<text>{{ units.find(e => e.id === item.options).text }}</text> |
|
|
|
<text>{{ units.find(e => e.id === item.options).text }}</text> |
|
|
@ -116,7 +116,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="label">结算价</view> |
|
|
|
<view class="label">结算价</view> |
|
|
|
<view v-if="!isHandle" class="defaultBox">{{ item.settlementPrice }}</view> |
|
|
|
<view v-if="isDetail" class="defaultBox">{{ item.settlementPrice }}</view> |
|
|
|
<view class="inline" v-else> |
|
|
|
<view class="inline" v-else> |
|
|
|
<input type="number" v-model="item.settlementPrice" placeholder="请输入" @change="handleErr(item, 'settlementPrice')" @input="updateServiceFee(item)"> |
|
|
|
<input type="number" v-model="item.settlementPrice" placeholder="请输入" @change="handleErr(item, 'settlementPrice')" @input="updateServiceFee(item)"> |
|
|
|
元 |
|
|
|
元 |
|
|
@ -132,7 +132,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]"> |
|
|
|
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]"> |
|
|
|
<view class="label">成交价</view> |
|
|
|
<view class="label">成交价</view> |
|
|
|
<view v-if="!isHandle" class="defaultBox">{{ item.finalPrice }}</view> |
|
|
|
<view v-if="isDetail" class="defaultBox">{{ item.finalPrice }}</view> |
|
|
|
<view class="inline" v-else> |
|
|
|
<view class="inline" v-else> |
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" :disabled="isEdit && !item.authority" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')"> |
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" :disabled="isEdit && !item.authority" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')"> |
|
|
|
元 |
|
|
|
元 |
|
|
@ -169,7 +169,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="product-btns"> |
|
|
|
<view class="product-btns"> |
|
|
|
<view v-if="!isDetail" class="btn" @click="submit">提交({{ courses.length }})</view> |
|
|
|
<view v-if="!isDetail" class="btn" @click="submit">提交({{ courses.length }})</view> |
|
|
|
<view v-if="isHandle || (!orderId && courses.length)" class="btn" @click="batchDeliver">{{ courses.find(e => !e.ship) ? '一键发货' : '取消全部发货' }}</view> |
|
|
|
<view v-if="isHandle || (!orderId && courses.length) && auth('订单管理:发货')" class="btn" @click="batchDeliver">{{ courses.find(e => !e.ship) ? '一键发货' : '取消全部发货' }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -211,6 +211,10 @@ |
|
|
|
<view class="ship-text" v-html="shipInfo" @click="copy"></view> |
|
|
|
<view class="ship-text" v-html="shipInfo" @click="copy"></view> |
|
|
|
<uni-easyinput type="textarea" v-model="shipContent" placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)" :disabled="isDetail"></uni-easyinput> |
|
|
|
<uni-easyinput type="textarea" v-model="shipContent" placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)" :disabled="isDetail"></uni-easyinput> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view v-if="!isDetail" class="ship-btns"> |
|
|
|
|
|
|
|
<button @click.stop="closeShip">取消</button> |
|
|
|
|
|
|
|
<button type="primary" @click.stop="submitShip">确定</button> |
|
|
|
|
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -292,7 +296,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
rate: '', |
|
|
|
rate: '', |
|
|
|
shipInfo: '', |
|
|
|
shipInfo: '', |
|
|
|
shipContent: '' |
|
|
|
shipContent: '', |
|
|
|
|
|
|
|
curRow: {} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -331,13 +336,12 @@ |
|
|
|
uni.removeStorageSync('courses') |
|
|
|
uni.removeStorageSync('courses') |
|
|
|
} catch (e) {} |
|
|
|
} catch (e) {} |
|
|
|
this.calcTotal() |
|
|
|
this.calcTotal() |
|
|
|
} else { |
|
|
|
} |
|
|
|
// 如果是客户订单记录页面点的新增,会有客户id,要默认选中该客户 |
|
|
|
// 如果是客户订单记录页面点的新增,会有客户id,要默认选中该客户 |
|
|
|
const { customerId } = options |
|
|
|
const { customerId } = options |
|
|
|
customerId && this.customerChange({ |
|
|
|
customerId && this.customerChange({ |
|
|
|
customerId |
|
|
|
customerId |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 非详情才需要查询客户 |
|
|
|
// 非详情才需要查询客户 |
|
|
|
this.isDetail || this.getCustomer() |
|
|
|
this.isDetail || this.getCustomer() |
|
|
|
// 设置标题 |
|
|
|
// 设置标题 |
|
|
@ -371,6 +375,9 @@ |
|
|
|
this.getBm() |
|
|
|
this.getBm() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
order.orderOther.forEach(e => { |
|
|
|
|
|
|
|
e.settlementPriceUnit = e.settlementPrice |
|
|
|
|
|
|
|
}) |
|
|
|
this.courses = order.orderOther |
|
|
|
this.courses = order.orderOther |
|
|
|
for (let i = 0; i < 5; i++) { |
|
|
|
for (let i = 0; i < 5; i++) { |
|
|
|
this.handleRenew(i) |
|
|
|
this.handleRenew(i) |
|
|
@ -401,25 +408,23 @@ |
|
|
|
e.serviceFee = (e.finalPrice * (this.rate / 100)).toFixed(2) // 服务费 != 0 && 才需要算 |
|
|
|
e.serviceFee = (e.finalPrice * (this.rate / 100)).toFixed(2) // 服务费 != 0 && 才需要算 |
|
|
|
courses['list' + e.authority].list.push(e) |
|
|
|
courses['list' + e.authority].list.push(e) |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log(123,courses) |
|
|
|
|
|
|
|
this.courseList = courses |
|
|
|
this.courseList = courses |
|
|
|
}).catch(e => {}) |
|
|
|
}).catch(e => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 处理开始结束时间和订单状态(参考pc,订单模块不是本人开发的,所以也不懂这里逻辑) |
|
|
|
// 处理开始结束时间和订单状态(参考pc,订单模块不是本人开发的,所以也不懂这里逻辑) |
|
|
|
handleRenew(authority) { |
|
|
|
handleRenew(authority) { |
|
|
|
const list = this.courses.filter(e => e.authority == authority) |
|
|
|
const list = this.courses.filter(e => e.authority == authority) |
|
|
|
const productId = list.map(e => e.dataOrCourseId) |
|
|
|
const productId = list.map(e => e.mallId) |
|
|
|
const mallId = list.map(e => e.mallId) |
|
|
|
|
|
|
|
productId.length && this.promises.push(new Promise((resolve, reject) => { |
|
|
|
productId.length && this.promises.push(new Promise((resolve, reject) => { |
|
|
|
renew({ |
|
|
|
renew({ |
|
|
|
authority, |
|
|
|
authority, |
|
|
|
customerId: this.form.customerId, |
|
|
|
customerId: this.form.customerId, |
|
|
|
productId, |
|
|
|
productId, |
|
|
|
mallId |
|
|
|
|
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
const { courses } = this |
|
|
|
const { courses } = this |
|
|
|
const now = new Date() |
|
|
|
const now = new Date() |
|
|
|
orderOthers.map(e => { |
|
|
|
orderOthers.map(e => { |
|
|
|
|
|
|
|
// e.settlementPriceUnit = e.settlementPrice |
|
|
|
const item = courses.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority) |
|
|
|
const item = courses.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority) |
|
|
|
if (item) { |
|
|
|
if (item) { |
|
|
|
if (this.isRenew) { // 续费 |
|
|
|
if (this.isRenew) { // 续费 |
|
|
@ -593,7 +598,10 @@ |
|
|
|
// 前往创建客户 |
|
|
|
// 前往创建客户 |
|
|
|
toClient() { |
|
|
|
toClient() { |
|
|
|
uni.setStorageSync('courses', this.courseList) |
|
|
|
uni.setStorageSync('courses', this.courseList) |
|
|
|
this.$util.to(`/order/clientDetail/clientDetail`) |
|
|
|
uni.redirectTo({ |
|
|
|
|
|
|
|
url: `/order/clientDetail/clientDetail` |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// this.$util.to(`/order/clientDetail/clientDetail`) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除课程 |
|
|
|
// 删除课程 |
|
|
|
delCourse(c, i) { |
|
|
|
delCourse(c, i) { |
|
|
@ -635,7 +643,7 @@ |
|
|
|
calcTotal(out) { |
|
|
|
calcTotal(out) { |
|
|
|
this.handleErr('orderType') |
|
|
|
this.handleErr('orderType') |
|
|
|
const { form } = this |
|
|
|
const { form } = this |
|
|
|
const isTrial = form.orderType === 2 // 是否试用 |
|
|
|
const isTrial = form.orderType == 2 // 是否试用 |
|
|
|
let total = 0 |
|
|
|
let total = 0 |
|
|
|
const list = this.courses |
|
|
|
const list = this.courses |
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
let purchase = 0 // 总采购成本 |
|
|
@ -654,16 +662,16 @@ |
|
|
|
list.map(e => { |
|
|
|
list.map(e => { |
|
|
|
// out=1 && 试用,则把结算价等重置为0 |
|
|
|
// out=1 && 试用,则把结算价等重置为0 |
|
|
|
if (out && isTrial) { |
|
|
|
if (out && isTrial) { |
|
|
|
|
|
|
|
console.log(123, e, out, isTrial) |
|
|
|
e.settlementPrice = 0 |
|
|
|
e.settlementPrice = 0 |
|
|
|
e.serviceFee = 0 |
|
|
|
e.serviceFee = 0 |
|
|
|
e.finalPrice = 0 |
|
|
|
e.finalPrice = 0 |
|
|
|
e.finalValue = 0 |
|
|
|
e.finalValue = 0 |
|
|
|
e.discountRate = '0%' |
|
|
|
e.discountRate = '0%' |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(111, e) |
|
|
|
|
|
|
|
this.calcDiscount(e) |
|
|
|
this.calcDiscount(e) |
|
|
|
this.dealSettlePrice(e) |
|
|
|
this.dealSettlePrice(e) |
|
|
|
this.calcFinalPrice(e) |
|
|
|
// this.calcFinalPrice(e) |
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
purchase += curPurchase |
|
|
|
purchase += curPurchase |
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
@ -672,10 +680,27 @@ |
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
form.profit = Math.round(profit) |
|
|
|
form.profit = Math.round(profit) |
|
|
|
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2) |
|
|
|
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2) |
|
|
|
|
|
|
|
console.log(111, this.courseList, this.courses) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 计算订单总额 |
|
|
|
|
|
|
|
calcAmount() { |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
const list = this.courses |
|
|
|
|
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
|
|
|
|
let profit = 0 // 总利润 |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
|
|
|
|
purchase += curPurchase |
|
|
|
|
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
|
|
|
|
form.profit = Math.round(profit) |
|
|
|
|
|
|
|
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2) |
|
|
|
|
|
|
|
console.log(111, this.courseList, this.courses) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 显示发货信息 |
|
|
|
// 显示发货信息 |
|
|
|
showShip(row) { |
|
|
|
showShip(row) { |
|
|
|
console.log(33) |
|
|
|
this.curRow = row |
|
|
|
let val = '' |
|
|
|
let val = '' |
|
|
|
row.mallNonAssociatedLinks && row.mallNonAssociatedLinks.forEach(e => { |
|
|
|
row.mallNonAssociatedLinks && row.mallNonAssociatedLinks.forEach(e => { |
|
|
|
val += e.urlName + ':' + e.url + '\n' |
|
|
|
val += e.urlName + ':' + e.url + '\n' |
|
|
@ -684,6 +709,16 @@ |
|
|
|
this.shipContent = row.shipContent || val |
|
|
|
this.shipContent = row.shipContent || val |
|
|
|
this.$refs.info.open() |
|
|
|
this.$refs.info.open() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭发货信息 |
|
|
|
|
|
|
|
closeShip() { |
|
|
|
|
|
|
|
this.$refs.info.close() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 提交发货信息 |
|
|
|
|
|
|
|
submitShip() { |
|
|
|
|
|
|
|
if (this.shipContent.length > 300) return this.$util.errMsg('请填写300个字以内!') |
|
|
|
|
|
|
|
this.curRow.shipContent = this.shipContent |
|
|
|
|
|
|
|
this.$refs.info.close() |
|
|
|
|
|
|
|
}, |
|
|
|
// 复制发货信息 |
|
|
|
// 复制发货信息 |
|
|
|
copy() { |
|
|
|
copy() { |
|
|
|
const that = this |
|
|
|
const that = this |
|
|
@ -730,64 +765,6 @@ |
|
|
|
this.courses = courses |
|
|
|
this.courses = courses |
|
|
|
this.isEdit && bulkShipping({orderOthers: courses}).then(res => {}).catch(res => {}) // 编辑的情况下,需要调接口去直接发货 |
|
|
|
this.isEdit && bulkShipping({orderOthers: courses}).then(res => {}).catch(res => {}) // 编辑的情况下,需要调接口去直接发货 |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
|
|
|
|
submit() { |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
const courses = [] |
|
|
|
|
|
|
|
if (!form.customerId) { |
|
|
|
|
|
|
|
this.err = 'customerName' |
|
|
|
|
|
|
|
return this.$util.errMsg('请选择客户!') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!form.orderType) { |
|
|
|
|
|
|
|
this.err = 'orderType' |
|
|
|
|
|
|
|
return this.$util.errMsg('请选择订单类型!') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (const i in this.courseList) { |
|
|
|
|
|
|
|
courses.push(...this.courseList[i].list) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!courses.length) return this.$util.errMsg('请选择课程权限或数据权限后再确认订单!') |
|
|
|
|
|
|
|
let invalid = 0 |
|
|
|
|
|
|
|
courses.forEach(e => { |
|
|
|
|
|
|
|
if (!e.periodOfUse) { |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
return this.$util.errMsg('请输入使用期限!') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
e.startTime = this.$util.formatDate(new Date(e.startTime), 'yyyy-MM-dd') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (invalid) return false |
|
|
|
|
|
|
|
if (this.isRenew || courses.some(e => e.renew)) form.orderNature = 2 |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
|
|
title: '提交中' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const data = { |
|
|
|
|
|
|
|
contractInformation: this.contract, // 合同信息 |
|
|
|
|
|
|
|
order: form, // 订单基本数据 |
|
|
|
|
|
|
|
orderOther: courses // 产品列表 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.isEdit || this.isHandle) { |
|
|
|
|
|
|
|
update(data).then(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
this.$util.sucMsg('编辑成功') |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
// this.$util.to(`../orders/orders`) |
|
|
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
|
|
}, 1500) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
add(data).then(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
this.$util.sucMsg('添加成功') |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
// this.$util.to(`../orders/orders`) |
|
|
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
|
|
}, 1500) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
calcDate(row, fromData) { |
|
|
|
calcDate(row, fromData) { |
|
|
|
clearTimeout(this.timer) |
|
|
|
clearTimeout(this.timer) |
|
|
|
this.timer = setTimeout(() => { |
|
|
|
this.timer = setTimeout(() => { |
|
|
@ -848,9 +825,8 @@ |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
}, |
|
|
|
}, |
|
|
|
dealSettlePrice(row) { |
|
|
|
dealSettlePrice(row) { |
|
|
|
console.log('dealSettlePrice', row) |
|
|
|
|
|
|
|
// 如果是试用,结算价和平台服务费都是0 |
|
|
|
// 如果是试用,结算价和平台服务费都是0 |
|
|
|
if (this.orderType == 2) { |
|
|
|
if (this.form.orderType == 2) { |
|
|
|
row.settlementPrice = 0 |
|
|
|
row.settlementPrice = 0 |
|
|
|
row.serviceFee = 0 |
|
|
|
row.serviceFee = 0 |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -869,7 +845,8 @@ |
|
|
|
row.settlementPrice = this.$util.handleNaN(sPrice) |
|
|
|
row.settlementPrice = this.$util.handleNaN(sPrice) |
|
|
|
// 平台服务费 |
|
|
|
// 平台服务费 |
|
|
|
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
console.log('row.settlementPrice =>' ,this.rate,row.serviceFee) |
|
|
|
this.calcAmount() |
|
|
|
|
|
|
|
console.log('row.settlementPrice =>' ,row.settlementPrice,row.settlementPriceUnit,sPrice,row) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
calcDiscount(row) { |
|
|
|
calcDiscount(row) { |
|
|
@ -928,7 +905,68 @@ |
|
|
|
// 结算价修改后计算平台服务费 |
|
|
|
// 结算价修改后计算平台服务费 |
|
|
|
updateServiceFee(row) { |
|
|
|
updateServiceFee(row) { |
|
|
|
options.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
options.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 提交 |
|
|
|
|
|
|
|
submit() { |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
const courses = [] |
|
|
|
|
|
|
|
if (!form.customerId) { |
|
|
|
|
|
|
|
this.err = 'customerName' |
|
|
|
|
|
|
|
return this.$util.errMsg('请选择客户!') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!form.orderType) { |
|
|
|
|
|
|
|
this.err = 'orderType' |
|
|
|
|
|
|
|
return this.$util.errMsg('请选择订单类型!') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (const i in this.courseList) { |
|
|
|
|
|
|
|
courses.push(...this.courseList[i].list) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!courses.length) return this.$util.errMsg('请选择课程权限或数据权限后再确认订单!') |
|
|
|
|
|
|
|
let invalid = 0 |
|
|
|
|
|
|
|
courses.forEach(e => { |
|
|
|
|
|
|
|
if (!e.periodOfUse) { |
|
|
|
|
|
|
|
invalid = 1 |
|
|
|
|
|
|
|
return this.$util.errMsg('请输入使用期限!') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
e.startTime = this.$util.formatDate(new Date(e.startTime), 'yyyy-MM-dd') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (invalid) return false |
|
|
|
|
|
|
|
if (this.isRenew || courses.some(e => e.renew)) form.orderNature = 2 |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
|
|
title: '提交中' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
const data = { |
|
|
|
|
|
|
|
contractInformation: this.contract, // 合同信息 |
|
|
|
|
|
|
|
order: form, // 订单基本数据 |
|
|
|
|
|
|
|
orderOther: courses // 产品列表 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.isEdit || this.isHandle) { |
|
|
|
|
|
|
|
update(data).then(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
this.$util.sucMsg('编辑成功') |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
// this.$util.to(`../orders/orders`) |
|
|
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
|
|
}, 1500) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
add(data).then(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
this.$util.sucMsg('添加成功') |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
// this.$util.to(`../orders/orders`) |
|
|
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
|
|
// uni.redirectTo({ |
|
|
|
|
|
|
|
// url: `../orders/orders` |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
}, 1500) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
@ -988,6 +1026,9 @@ |
|
|
|
padding: 0 16rpx; |
|
|
|
padding: 0 16rpx; |
|
|
|
margin-right: 10rpx; |
|
|
|
margin-right: 10rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
&.mg { |
|
|
|
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.del { |
|
|
|
.del { |
|
|
|
width: 40rpx; |
|
|
|
width: 40rpx; |
|
|
@ -1029,6 +1070,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.bottom { |
|
|
|
.bottom { |
|
|
|
|
|
|
|
z-index: 2; |
|
|
|
position: fixed; |
|
|
|
position: fixed; |
|
|
|
bottom: 0; |
|
|
|
bottom: 0; |
|
|
|
padding-bottom: env(safe-area-inset-bottom); |
|
|
|
padding-bottom: env(safe-area-inset-bottom); |
|
|
@ -1155,15 +1197,17 @@ |
|
|
|
color: #333; |
|
|
|
color: #333; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.edit { |
|
|
|
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.period { |
|
|
|
.period { |
|
|
|
display: inline-block; |
|
|
|
flex: none; |
|
|
|
text-align: right; |
|
|
|
width: 100rpx; |
|
|
|
margin-right: 10rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
margin-left: 20rpx; |
|
|
|
text-align: center; |
|
|
|
color: #333; |
|
|
|
|
|
|
|
width: 60%;font-size: 28rpx; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.defaultBox { |
|
|
|
.defaultBox { |
|
|
|
font-size: 28rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
} |
|
|
|
} |
|
|
@ -1175,4 +1219,17 @@ |
|
|
|
margin-bottom: 20rpx; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.ship-btns { |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
button { |
|
|
|
|
|
|
|
padding: 0 16rpx; |
|
|
|
|
|
|
|
margin: 0; |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
&:first-child { |
|
|
|
|
|
|
|
margin-right: 20rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|