|
|
|
@ -1,79 +1,81 @@ |
|
|
|
|
<template> |
|
|
|
|
<view class="page"> |
|
|
|
|
<template v-for="c in courses"> |
|
|
|
|
<view v-if="c.list.length" class="block"> |
|
|
|
|
<view v-if="c.list.length && c.list.filter(e => !e.edited).length" class="block"> |
|
|
|
|
<view class="l-title">{{ c.name }}</view> |
|
|
|
|
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> |
|
|
|
|
<view v-show="!c.shrink"> |
|
|
|
|
<view v-for="(item, i) in c.list"> |
|
|
|
|
<view class="pro-name"> |
|
|
|
|
<view class="left"> |
|
|
|
|
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image> |
|
|
|
|
{{ item.productName }} |
|
|
|
|
</view> |
|
|
|
|
<uni-icons v-if="isAdd || isRenew" class="del" type="trash" size="25" color="#ADADAD" @click="delCourse(c, i)"></uni-icons> |
|
|
|
|
</view> |
|
|
|
|
<view class="form-list"> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">产品类型</view> |
|
|
|
|
<view class="val">{{ productTypes.find(e => e.id === item.productType).name }}</view> |
|
|
|
|
<template v-for="(item, i) in c.list"> |
|
|
|
|
<view v-if="!item.edited" :key="i"> |
|
|
|
|
<view class="pro-name"> |
|
|
|
|
<view class="left"> |
|
|
|
|
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image> |
|
|
|
|
{{ item.productName }} |
|
|
|
|
</view> |
|
|
|
|
<uni-icons v-if="isAdd || isRenew" class="del" type="trash" size="25" color="#ADADAD" @click="delCourse(c, i)"></uni-icons> |
|
|
|
|
</view> |
|
|
|
|
<view :class="['line', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">使用期限</view> |
|
|
|
|
<view class="period-wrap"> |
|
|
|
|
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" :disabled="isEdit" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')"> |
|
|
|
|
<view class="form-list"> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">产品类型</view> |
|
|
|
|
<view class="val">{{ item.typeName }}</view> |
|
|
|
|
</view> |
|
|
|
|
<view v-if="isEdit">{{ 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 :class="['line', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">使用期限</view> |
|
|
|
|
<view class="period-wrap"> |
|
|
|
|
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" :disabled="isEdit" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')"> |
|
|
|
|
</view> |
|
|
|
|
<view v-if="isEdit">{{ 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> |
|
|
|
|
<view :class="['line req', {err: err === 'startTime' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">起止日期</view> |
|
|
|
|
<view v-if="isEdit">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view> |
|
|
|
|
<view v-else class="val unit"> |
|
|
|
|
<uni-datetime-picker 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> |
|
|
|
|
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> |
|
|
|
|
<view :class="['line req', {err: err === 'startTime' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">起止日期</view> |
|
|
|
|
<view v-if="isEdit">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view> |
|
|
|
|
<view v-else class="val unit"> |
|
|
|
|
<uni-datetime-picker 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> |
|
|
|
|
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view :class="['line req', {err: err === 'accountNum' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">数量</view> |
|
|
|
|
<view v-if="item.authority" class="ph">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="name">{{ item.authority ? '市场价' : '市场单价' }}</view> |
|
|
|
|
<view class="ph">{{ item.marketValue }}元</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">结算价</view> |
|
|
|
|
<view class="inline"> |
|
|
|
|
<input type="number" v-model="item.settlementPrice" placeholder="请输入" @change="handleErr(item, 'settlementPrice')"> |
|
|
|
|
元 |
|
|
|
|
<view :class="['line req', {err: err === 'accountNum' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">数量</view> |
|
|
|
|
<view v-if="item.authority" class="ph">1</view> |
|
|
|
|
<input v-else type="number" v-model="item.accountNum" placeholder="请输入账号数量" @input="calcFinalPrice(item)" @change="handleErr(item, 'accountNum')"> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">折扣率</view> |
|
|
|
|
<view class="ph">{{ item.discountRate }}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">平台服务费</view> |
|
|
|
|
<view class="ph">{{ item.serviceFee }}元</view> |
|
|
|
|
</view> |
|
|
|
|
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">成交价</view> |
|
|
|
|
<view class="inline"> |
|
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" :disabled="isEdit && !item.authority" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')"> |
|
|
|
|
元 |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">{{ item.authority ? '市场价' : '市场单价' }}</view> |
|
|
|
|
<view class="ph">{{ item.marketValue }}元</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">结算价</view> |
|
|
|
|
<view class="inline"> |
|
|
|
|
<input type="number" v-model="item.settlementPrice" placeholder="请输入" @change="handleErr(item, 'settlementPrice')"> |
|
|
|
|
元 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">折扣率</view> |
|
|
|
|
<view class="ph">{{ item.discountRate }}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">平台服务费</view> |
|
|
|
|
<view class="ph">{{ item.serviceFee }}元</view> |
|
|
|
|
</view> |
|
|
|
|
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
<view class="name">成交价</view> |
|
|
|
|
<view class="inline"> |
|
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" :disabled="isEdit && !item.authority" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')"> |
|
|
|
|
元 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
@ -86,7 +88,7 @@ |
|
|
|
|
<script> |
|
|
|
|
import { getOrderOtherTime } from '@/apis/modules/order.js' |
|
|
|
|
import { getPartnerTeamRates } from '@/apis/modules/parner.js' |
|
|
|
|
import { productCategoryList } from '@/apis/modules/product.js' |
|
|
|
|
import { productCategoryList, productTypeList } from '@/apis/modules/product.js' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -133,23 +135,22 @@ |
|
|
|
|
methods: { |
|
|
|
|
// 转换产品列表 |
|
|
|
|
handleProduct() { |
|
|
|
|
// 产品类型 |
|
|
|
|
productTypeList().then(res => { |
|
|
|
|
this.productTypes = res.typeList |
|
|
|
|
}).catch(e => {}) |
|
|
|
|
|
|
|
|
|
const list = uni.getStorageSync('courses') |
|
|
|
|
let courses = {} |
|
|
|
|
// 产品分类 |
|
|
|
|
productCategoryList().then(res => { |
|
|
|
|
const typeList = [] |
|
|
|
|
res.classificationList.forEach(e => { |
|
|
|
|
typeList.push({ |
|
|
|
|
id: e.classificationId, |
|
|
|
|
name: e.classificationName |
|
|
|
|
}) |
|
|
|
|
courses['list' + this.$util.getOrderType(e.classificationId)] = { |
|
|
|
|
shrink: false, |
|
|
|
|
name: e.classificationName, |
|
|
|
|
list: [] |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.productTypes = typeList |
|
|
|
|
list.map(e => { |
|
|
|
|
courses['list' + e.authority].list.push(e) |
|
|
|
|
}) |
|
|
|
@ -249,9 +250,9 @@ |
|
|
|
|
}, |
|
|
|
|
// 计算结算价及平台服务费 |
|
|
|
|
dealSettlePrice(row) { |
|
|
|
|
// 如果是试用,结算价和平台服务费都是0 |
|
|
|
|
// 如果是试用或者没选择,结算价和平台服务费都是0 |
|
|
|
|
console.log('dealSettlePrice=>', row, this.orderType) |
|
|
|
|
if (this.orderType == 2) { |
|
|
|
|
if (this.orderType != 1) { |
|
|
|
|
row.settlementPrice = 0 |
|
|
|
|
row.serviceFee = 0 |
|
|
|
|
} else { |
|
|
|
@ -365,10 +366,12 @@ |
|
|
|
|
msg = '请输入成交价!' |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
e.edited = 1 // 未编辑过的标识,编辑过了的产品在编辑产品页不再显示 |
|
|
|
|
} |
|
|
|
|
if (msg) return this.$util.errMsg(msg) |
|
|
|
|
if (this.orderRepeat.length) return this.$util.errMsg(this.repeatMsg) // 有重复订单不能提交 |
|
|
|
|
uni.setStorageSync('courses', this.courses) |
|
|
|
|
uni.setStorageSync('orderEdited', 1) |
|
|
|
|
uni.navigateBack() |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|