|
|
|
@ -66,16 +66,19 @@ |
|
|
|
|
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image> |
|
|
|
|
{{ item.productName }} |
|
|
|
|
</view> |
|
|
|
|
<view class="course-action"> |
|
|
|
|
<image v-if="!isDetail" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image> |
|
|
|
|
<button v-if="item.authority == 3 || item.authority == 4" class="info-btn" type="primary" @click.stop="showShip(item)">发货信息</button> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="info"> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="label">使用期限</view> |
|
|
|
|
<view class="val">{{ item.startTime + ' - ' + item.endTime }}</view> |
|
|
|
|
<view class="val">{{ item.startTime + (item.endTime ? ' - ' + item.endTime : '') }}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="label">市场价(元)</view> |
|
|
|
|
<view class="val">{{ item.marketValue }}元</view> |
|
|
|
|
<view class="val">{{ item.marketValue && item.marketValue + '元' }}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="label">结算价</view> |
|
|
|
@ -135,12 +138,16 @@ |
|
|
|
|
<view class="item" v-for="item in customerList" @click="customerChange(item)">{{ item.customerName }}</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<uni-popup ref="info" type="bottom" background-color="#fff"> |
|
|
|
|
<view class="ship-info" v-html="shipInfo" @click="copy"></view> |
|
|
|
|
</uni-popup> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { productCategoryList, delCart } from '@/apis/modules/product.js' |
|
|
|
|
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js' |
|
|
|
|
import { add, update, getDetail } from '@/apis/modules/order.js' |
|
|
|
|
import { add, update, getDetail, queryCitySettlementPrice } from '@/apis/modules/order.js' |
|
|
|
|
import { getPartnerTeamRates } from '@/apis/modules/parner.js' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
@ -191,7 +198,8 @@ |
|
|
|
|
customerList: [], |
|
|
|
|
customerListAll: [], |
|
|
|
|
err: '', |
|
|
|
|
rate: '' |
|
|
|
|
rate: '', |
|
|
|
|
shipInfo: '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -212,6 +220,7 @@ |
|
|
|
|
if (this.orderId) { |
|
|
|
|
this.getInfo() |
|
|
|
|
} else if (store) { |
|
|
|
|
console.log(33, store) |
|
|
|
|
// 新增取缓存,取了删除 |
|
|
|
|
const list = [] |
|
|
|
|
for (const i in store) { |
|
|
|
@ -273,38 +282,24 @@ |
|
|
|
|
}, |
|
|
|
|
// 转换产品列表 |
|
|
|
|
handleProduct(list) { |
|
|
|
|
const courses = { |
|
|
|
|
practice: { |
|
|
|
|
shrink: false, |
|
|
|
|
name: '实训课程产品', |
|
|
|
|
list: [] |
|
|
|
|
}, |
|
|
|
|
theory: { |
|
|
|
|
shrink: false, |
|
|
|
|
name: '理论课程产品', |
|
|
|
|
list: [] |
|
|
|
|
}, |
|
|
|
|
data: { |
|
|
|
|
let courses = {} |
|
|
|
|
// 产品分类 |
|
|
|
|
productCategoryList().then(res => { |
|
|
|
|
res.classificationList.forEach(e => { |
|
|
|
|
courses['list' + this.$util.getOrderType(e.classificationId)] = { |
|
|
|
|
shrink: false, |
|
|
|
|
name: '数据产品', |
|
|
|
|
name: e.classificationName, |
|
|
|
|
list: [] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 3个分类的课程分别push到不同数组(0->理论 1-实训 2 数据产品) |
|
|
|
|
list.map(e => { |
|
|
|
|
console.log('e.=>',e) |
|
|
|
|
console.log('this.rate=>',this.rate) |
|
|
|
|
e.serviceFee = (e.finalPrice * (this.rate / 100)).toFixed(2) // 服务费 != 0 && 才需要算 |
|
|
|
|
|
|
|
|
|
console.log('e.serviceFee=>',e.serviceFee) |
|
|
|
|
const type = e.productType |
|
|
|
|
!type ? |
|
|
|
|
courses.theory.list.push(e) : |
|
|
|
|
type === 1 ? |
|
|
|
|
courses.practice.list.push(e) : |
|
|
|
|
courses.data.list.push(e) |
|
|
|
|
courses['list' + e.authority].list.push(e) |
|
|
|
|
}) |
|
|
|
|
console.log(123,courses) |
|
|
|
|
this.courseList = courses |
|
|
|
|
}).catch(e => {}) |
|
|
|
|
}, |
|
|
|
|
// 获取客户列表 |
|
|
|
|
getCustomer() { |
|
|
|
@ -333,25 +328,44 @@ |
|
|
|
|
this.keyword = '' |
|
|
|
|
}, |
|
|
|
|
// 客户名称选择回调 |
|
|
|
|
customerChange(item) { |
|
|
|
|
async customerChange(item) { |
|
|
|
|
const { form } = this |
|
|
|
|
// 获取客户详情 |
|
|
|
|
queryCustomerDetails({ |
|
|
|
|
const { result } = await queryCustomerDetails({ |
|
|
|
|
customerId: item.customerId |
|
|
|
|
}).then(({ result }) => { |
|
|
|
|
}) |
|
|
|
|
this.handleErr('customerName') |
|
|
|
|
const e = result.customer |
|
|
|
|
const { provinceId, cityId } = e |
|
|
|
|
form.customerId = e.customerId |
|
|
|
|
form.customerName = e.customerName |
|
|
|
|
form.provinceId = e.provinceId |
|
|
|
|
form.cityId = e.cityId |
|
|
|
|
form.provinceId = provinceId |
|
|
|
|
form.cityId = cityId |
|
|
|
|
form.provinceName = e.provinceName |
|
|
|
|
form.cityName = e.cityName |
|
|
|
|
form.phone = e.phone |
|
|
|
|
form.email = e.email |
|
|
|
|
form.orderContact = e.name |
|
|
|
|
}).catch(e => {}) |
|
|
|
|
|
|
|
|
|
// 获取平台结算价重新计算课程的相关参数 |
|
|
|
|
const list = this.courseList |
|
|
|
|
const courses = [] |
|
|
|
|
const promises = [] |
|
|
|
|
for (const i in list) { |
|
|
|
|
list[i].list.forEach(n => { |
|
|
|
|
promises.push(new Promise(async (resolve, reject) => { |
|
|
|
|
const res = await queryCitySettlementPrice(n.mallId, provinceId, cityId) |
|
|
|
|
if (res.mallPrice) n.settlementPriceUnit = res.mallPrice.discountRate || 0 |
|
|
|
|
courses.push(n) |
|
|
|
|
resolve() |
|
|
|
|
})) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
this.courses = courses |
|
|
|
|
this.calcTotal() |
|
|
|
|
this.closeCustomer() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 查询合伙人团队费率 |
|
|
|
|
getRate() { |
|
|
|
@ -469,7 +483,7 @@ |
|
|
|
|
1 : |
|
|
|
|
row.accountNum)).toFixed((2)) |
|
|
|
|
row.settlementPrice = this.$util.handleNaN(sPrice) |
|
|
|
|
// 平台服务费(结算价*10%) |
|
|
|
|
// 平台服务费 |
|
|
|
|
if (row.settlementPrice) { |
|
|
|
|
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
|
} |
|
|
|
@ -498,6 +512,26 @@ |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 显示发货信息 |
|
|
|
|
showShip(row) { |
|
|
|
|
console.log(33) |
|
|
|
|
let val = '' |
|
|
|
|
row.mallNonAssociatedLinks && row.mallNonAssociatedLinks.forEach(e => { |
|
|
|
|
val += e.urlName + ':' + e.url + '\n' |
|
|
|
|
}) |
|
|
|
|
this.shipInfo = val |
|
|
|
|
this.$refs.info.open() |
|
|
|
|
}, |
|
|
|
|
// 复制发货信息 |
|
|
|
|
copy() { |
|
|
|
|
const that = this |
|
|
|
|
uni.setClipboardData({ |
|
|
|
|
data: this.shipInfo, |
|
|
|
|
success() { |
|
|
|
|
that.$util.sucMsg('编辑成功') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 处理错误提示 |
|
|
|
|
handleErr(val) { |
|
|
|
|
if (val === this.err) this.err = '' |
|
|
|
@ -507,7 +541,9 @@ |
|
|
|
|
uni.requestSubscribeMessage({ |
|
|
|
|
tmplIds: ['8pDVfWYqh9c-nn3CeA1NXJtBxdd1FYiCtrl5BeLvbgU'], |
|
|
|
|
success: (res) => { |
|
|
|
|
uni.navigateBack() |
|
|
|
|
uni.switchTab({ |
|
|
|
|
url: '/pages/orders/orders' |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
fail: function(err) { |
|
|
|
|
uni.showToast({ |
|
|
|
@ -519,6 +555,11 @@ |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 从购物车选择产品下单的,则提交订单后删除购物车相对应产品 |
|
|
|
|
async delShopCart(courses) { |
|
|
|
|
const list = courses.filter(e => e.shopCartId) |
|
|
|
|
list.length && await delCart(list.map(e => e.shopCartId)) |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit() { |
|
|
|
|
const { form, courses } = this |
|
|
|
@ -530,7 +571,7 @@ |
|
|
|
|
this.err = 'orderType' |
|
|
|
|
return this.$util.errMsg('请选择订单类型!') |
|
|
|
|
} |
|
|
|
|
if (!courses.length) return this.$util.errMsg('请选择课程权限或数据权限后再确认订单!') |
|
|
|
|
if (!courses.length) return this.$util.errMsg('请选择课程后再确认订单!') |
|
|
|
|
courses.map(e => { |
|
|
|
|
e.startTime = this.$util.formatDate(new Date(e.startTime), 'yyyy-MM-dd') |
|
|
|
|
}) |
|
|
|
@ -547,13 +588,16 @@ |
|
|
|
|
uni.hideLoading() |
|
|
|
|
this.$util.sucMsg('编辑成功') |
|
|
|
|
setTimeout(() => { |
|
|
|
|
uni.navigateBack() |
|
|
|
|
uni.switchTab({ |
|
|
|
|
url: '/pages/orders/orders' |
|
|
|
|
}) |
|
|
|
|
}, 1500) |
|
|
|
|
}).catch(res => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
add(data).then(res => { |
|
|
|
|
this.delShopCart(courses) |
|
|
|
|
uni.hideLoading() |
|
|
|
|
this.$util.sucMsg('添加成功') |
|
|
|
|
this.publicNotice() |
|
|
|
@ -605,6 +649,15 @@ |
|
|
|
|
color: #333; |
|
|
|
|
background: linear-gradient(90deg, #FFF5E5 0%, #FFFFFF 100%); |
|
|
|
|
} |
|
|
|
|
.course-action { |
|
|
|
|
display: inline-flex; |
|
|
|
|
align-items: center; |
|
|
|
|
} |
|
|
|
|
.info-btn { |
|
|
|
|
padding: 0 16rpx; |
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
} |
|
|
|
|
.left { |
|
|
|
|
display: inline-flex; |
|
|
|
|
align-items: center; |
|
|
|
@ -744,4 +797,9 @@ |
|
|
|
|
background-color: #007EFF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.ship-info { |
|
|
|
|
padding: 20rpx; |
|
|
|
|
white-space: pre-wrap; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|