parent
92e4cd7bd9
commit
bd81608900
13 changed files with 1020 additions and 596 deletions
@ -0,0 +1,6 @@ |
|||||||
|
import request from '@/apis/request.js' |
||||||
|
const { get, post } = request |
||||||
|
|
||||||
|
export const curriculumList = (data) => { |
||||||
|
return post('nakadai/nakadai/curriculum/curriculumList', data) |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
<template> |
||||||
|
<view class="none"> |
||||||
|
<image src="../../static/image/none.png" mode="widthFix"></image> |
||||||
|
<view class="text">暂无数据</view> |
||||||
|
</view> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped lang="scss"> |
||||||
|
.none { |
||||||
|
padding-top: 100rpx; |
||||||
|
text-align: center; |
||||||
|
image { |
||||||
|
width: 426rpx; |
||||||
|
margin-bottom: 52rpx; |
||||||
|
} |
||||||
|
.text { |
||||||
|
font-size: 28rpx; |
||||||
|
color: #333; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,201 @@ |
|||||||
|
<template> |
||||||
|
<view class="page"> |
||||||
|
<uni-card :is-shadow="false" :border="false" padding="0" is-full> |
||||||
|
<uni-search-bar class="search" radius="5" placeholder="请输入产品名称" clearButton="auto" cancelButton="none" v-model="keyword" /> |
||||||
|
</uni-card> |
||||||
|
|
||||||
|
<ul class="tab"> |
||||||
|
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li> |
||||||
|
</ul> |
||||||
|
|
||||||
|
<ul class="list"> |
||||||
|
<li v-for="item in list"> |
||||||
|
<uni-data-checkbox class="check" multiple v-model="item.check" :localdata="checkData"></uni-data-checkbox> |
||||||
|
<image class="icon" src="../../static/image/course1.png" mode="widthFix"></image> |
||||||
|
{{ item.curriculumName }} |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
|
||||||
|
<view class="btn-wrap"> |
||||||
|
<uni-data-checkbox class="check" multiple v-model="checkAll" :localdata="checkAllData" @change="checkChange"></uni-data-checkbox> |
||||||
|
<view class="btn" @click="submit">确定</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { curriculumList } from '@/apis/modules/course.js' |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
orderType: 0, |
||||||
|
curTab: '', |
||||||
|
tabs: [ |
||||||
|
{ |
||||||
|
name: '不限', |
||||||
|
id: '' |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: '实训课程', |
||||||
|
id: 1 |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: '理论课程', |
||||||
|
id: 0 |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: '数据产品', |
||||||
|
id: 3 |
||||||
|
} |
||||||
|
], |
||||||
|
searchTimer: null, |
||||||
|
orderStatus: '', |
||||||
|
productStatus: '', |
||||||
|
keyword: '', |
||||||
|
list: [], |
||||||
|
listAll: [], |
||||||
|
page: 1, |
||||||
|
pageSize: 10, |
||||||
|
checkData: [{ |
||||||
|
text: '', |
||||||
|
value: 1 |
||||||
|
}], |
||||||
|
checkAll: [], |
||||||
|
checkAllData: [{ |
||||||
|
text: '全部', |
||||||
|
value: 1 |
||||||
|
}], |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
keyword () { |
||||||
|
clearTimeout(this.searchTimer) |
||||||
|
this.searchTimer = setTimeout(() => { |
||||||
|
this.getList() |
||||||
|
}, 500) |
||||||
|
} |
||||||
|
}, |
||||||
|
// 下拉刷新 |
||||||
|
onPullDownRefresh() { |
||||||
|
this.getList() |
||||||
|
setTimeout(() => { |
||||||
|
uni.stopPullDownRefresh() |
||||||
|
}, 1500) |
||||||
|
}, |
||||||
|
onShow() { |
||||||
|
const pages = getCurrentPages() |
||||||
|
this.orderType = pages[pages.length - 1].options.orderType |
||||||
|
this.getList() |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
getList() { |
||||||
|
curriculumList({ |
||||||
|
curriculumName: this.keyword, |
||||||
|
isEnable: 0, |
||||||
|
pageNum: 1, |
||||||
|
pageSize: 10000 |
||||||
|
}).then(({ page }) => { |
||||||
|
const { records } = page |
||||||
|
records.map(e => { |
||||||
|
e.check = [] |
||||||
|
}) |
||||||
|
this.list = records |
||||||
|
}).catch(e => {}) |
||||||
|
}, |
||||||
|
// tab切换 |
||||||
|
tabChange(tab) { |
||||||
|
this.curTab = tab.id |
||||||
|
}, |
||||||
|
// 全选 |
||||||
|
checkChange(e) { |
||||||
|
const checked = !!e.detail.value.length |
||||||
|
this.list.map(e => e.check = [checked ? 1 : '']) // 选中则为[1],取消选中为[] |
||||||
|
}, |
||||||
|
// 生成产品参数 |
||||||
|
createParam(e) { |
||||||
|
return { |
||||||
|
dataOrCourseId: e.cid, // id |
||||||
|
productName: e.curriculumName, // 名称 |
||||||
|
periodOfUse: '', // 使用期限 |
||||||
|
startTime: this.$util.formatDate(new Date(), 'yyyy-MM-dd'), // 开始 |
||||||
|
endTime: '', // 终止 |
||||||
|
remainingPeriod: '', // 剩余期限 |
||||||
|
marketValue: '', // 市场价 |
||||||
|
marketPrice: e.marketPrice, // 市场单价 |
||||||
|
finalPrice: this.orderType === 2 ? 0 : '', // 成交价 |
||||||
|
discountRate: '', // 折扣率 |
||||||
|
accountNum: '', // 账号数 |
||||||
|
totalAmount: '', // 总价 |
||||||
|
isEnable: 1, // 启用否:1启用,0禁用 |
||||||
|
ship: 0, // 发货否(0未发货,1已发货,默认不发货) |
||||||
|
authority: 1, // 区分权限 0为数据平台权限,1为课程权限 |
||||||
|
options: 1, |
||||||
|
settlementPrice: '', // 结算价 |
||||||
|
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 |
||||||
|
settlementPriceUnit: e.settlementPrice, // 结算单价 |
||||||
|
businessProportion: e.businessProportion, // 商务占比 |
||||||
|
} |
||||||
|
}, |
||||||
|
// 确定 |
||||||
|
submit() { |
||||||
|
const list = this.list.filter(e => e.check.length) // 筛选出选中了的产品 |
||||||
|
if (list.length) { |
||||||
|
const result = [] |
||||||
|
list.map(e => { |
||||||
|
result.push(this.createParam(e)) |
||||||
|
}) |
||||||
|
uni.setStorageSync('courses', result) // 把选中的产品添加至缓存 |
||||||
|
uni.redirectTo({ |
||||||
|
url: `../editCourse/editCourse` |
||||||
|
}) |
||||||
|
} else { |
||||||
|
this.$util.errMsg('请选择产品!') |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped lang="scss"> |
||||||
|
.page { |
||||||
|
height: calc(100vh - 140rpx); |
||||||
|
overflow: auto; |
||||||
|
} |
||||||
|
.list { |
||||||
|
li { |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
padding: 30rpx 24rpx; |
||||||
|
margin: 16rpx 24rpx; |
||||||
|
font-size: 30rpx; |
||||||
|
color: #333; |
||||||
|
background-color: #fff; |
||||||
|
border-radius: 16rpx; |
||||||
|
} |
||||||
|
.icon { |
||||||
|
width: 80rpx; |
||||||
|
margin: 0 20rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
/deep/.check { |
||||||
|
.checklist-box { |
||||||
|
margin: 0 !important; |
||||||
|
} |
||||||
|
.checkbox__inner { |
||||||
|
width: 40rpx !important; |
||||||
|
height: 40rpx !important; |
||||||
|
border-radius: 50% !important; |
||||||
|
} |
||||||
|
.checkbox__inner-icon { |
||||||
|
top: 8rpx !important; |
||||||
|
left: 14rpx !important; |
||||||
|
} |
||||||
|
} |
||||||
|
.btn-wrap { |
||||||
|
justify-content: space-between; |
||||||
|
.btn { |
||||||
|
width: 340rpx; |
||||||
|
margin-left: 27rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -1,182 +0,0 @@ |
|||||||
<template> |
|
||||||
<view class="container"> |
|
||||||
<uni-section title="基本信息" type="line"> |
|
||||||
<view class="form"> |
|
||||||
<uni-forms ref="baseForm" :modelValue="form" label-width="100"> |
|
||||||
<uni-forms-item label="商务经理"> |
|
||||||
<uni-easyinput v-model="form.provience" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="客户名称" name="contact" required> |
|
||||||
<uni-easyinput v-model="form.contact" placeholder="请选择" /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="省份"> |
|
||||||
<uni-easyinput v-model="form.provience" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="城市"> |
|
||||||
<uni-easyinput v-model="form.city" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="联系人"> |
|
||||||
<uni-easyinput v-model="form.provience" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="电话"> |
|
||||||
<uni-easyinput v-model="form.city" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="邮箱"> |
|
||||||
<uni-easyinput v-model="form.provience" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="订单类型"> |
|
||||||
<uni-data-checkbox v-model="form.orderType" :localdata="orderTypes"></uni-data-checkbox> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="订单编号"> |
|
||||||
<uni-easyinput v-model="form.provience" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="订单时间"> |
|
||||||
<uni-easyinput v-model="form.city" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
<uni-forms-item label="订单金额(元)"> |
|
||||||
<uni-easyinput v-model="form.provience" disabled /> |
|
||||||
</uni-forms-item> |
|
||||||
</uni-forms> |
|
||||||
</view> |
|
||||||
</uni-section> |
|
||||||
|
|
||||||
<uni-section title="订单产品" type="line"> |
|
||||||
<view class="card"> |
|
||||||
<button type="primary">添加产品</button> |
|
||||||
</view> |
|
||||||
</uni-section> |
|
||||||
<view class="product"> |
|
||||||
<view class="total"> |
|
||||||
<text>已选()个产品</text> |
|
||||||
<text>总成交价合计:20000(元)</text> |
|
||||||
</view> |
|
||||||
<view class="list"> |
|
||||||
<view class="line">总采购成本:</view> |
|
||||||
<view class="line">总产品利润:</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<uni-card :is-shadow="false" :border="false" is-full> |
|
||||||
<button type="primary" @click="submit('valiForm')">提交</button> |
|
||||||
</uni-card> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
|
||||||
orderTypes: [{ |
|
||||||
text: '正式', |
|
||||||
value: 0 |
|
||||||
}, { |
|
||||||
text: '试用', |
|
||||||
value: 1 |
|
||||||
}], |
|
||||||
candidates: ['北京', '南京', '东京', '武汉', '天津', '上海', '海口'], |
|
||||||
dataTree: [{ |
|
||||||
text: "一年级", |
|
||||||
value: "1-0", |
|
||||||
children: [{ |
|
||||||
text: "1.1班", |
|
||||||
value: "1-1" |
|
||||||
}, |
|
||||||
{ |
|
||||||
text: "1.2班", |
|
||||||
value: "1-2" |
|
||||||
} |
|
||||||
] |
|
||||||
}, |
|
||||||
{ |
|
||||||
text: "二年级", |
|
||||||
value: "2-0", |
|
||||||
children: [{ |
|
||||||
text: "2.1班", |
|
||||||
value: "2-1" |
|
||||||
}, |
|
||||||
{ |
|
||||||
text: "2.2班", |
|
||||||
value: "2-2" |
|
||||||
} |
|
||||||
] |
|
||||||
}, |
|
||||||
{ |
|
||||||
text: "三年级", |
|
||||||
value: "3-0", |
|
||||||
disable: true |
|
||||||
} |
|
||||||
], |
|
||||||
form: { |
|
||||||
orderType: 0, |
|
||||||
provience: '', |
|
||||||
city: '', |
|
||||||
industryId: '', |
|
||||||
age: '', |
|
||||||
introduction: '', |
|
||||||
sex: 2, |
|
||||||
hobby: [5], |
|
||||||
datetimesingle: 1627529992399 |
|
||||||
}, |
|
||||||
sexs: [{ |
|
||||||
text: '男', |
|
||||||
value: 0 |
|
||||||
}, { |
|
||||||
text: '女', |
|
||||||
value: 1 |
|
||||||
}, { |
|
||||||
text: '保密', |
|
||||||
value: 2 |
|
||||||
}], |
|
||||||
} |
|
||||||
}, |
|
||||||
onLoad() { |
|
||||||
console.log(getApp()) |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
bindPickerChange: function(e) { |
|
||||||
console.log('picker发送选择改变,携带值为', e.detail.value) |
|
||||||
this.index = e.detail.value |
|
||||||
}, |
|
||||||
onchange(e) { |
|
||||||
console.log('---------onchange:', e); |
|
||||||
}, |
|
||||||
submit(ref) { |
|
||||||
this.$refs[ref].validate().then(res => { |
|
||||||
console.log('success', res); |
|
||||||
uni.showToast({ |
|
||||||
title: `校验通过` |
|
||||||
}) |
|
||||||
}).catch(err => { |
|
||||||
console.log('err', err); |
|
||||||
}) |
|
||||||
}, |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
|
||||||
|
|
||||||
<style scoped lang="scss"> |
|
||||||
.form { |
|
||||||
padding: 15px; |
|
||||||
background-color: #fff; |
|
||||||
} |
|
||||||
.card { |
|
||||||
padding: 15px; |
|
||||||
} |
|
||||||
.product { |
|
||||||
margin: 10px 0; |
|
||||||
background-color: #fff; |
|
||||||
.total { |
|
||||||
display: flex; |
|
||||||
justify-content: space-between; |
|
||||||
padding: 10px 15px; |
|
||||||
font-size: 13px; |
|
||||||
border-bottom: 1px solid #ddd; |
|
||||||
} |
|
||||||
.list { |
|
||||||
padding: 10px 15px; |
|
||||||
.line { |
|
||||||
line-height: 30px; |
|
||||||
font-size: 12px; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</style> |
|
@ -1,322 +1,317 @@ |
|||||||
<template> |
<template> |
||||||
<view :class="{page: isDetail}"> |
<view class="page"> |
||||||
<uni-card v-if="customerId" :is-shadow="false" :border="false" is-full> |
<uni-card v-if="customerId" :is-shadow="false" :border="false" is-full> |
||||||
<view class="info"> |
<view class="info"> |
||||||
<view class="name">{{ form.customerName }}</view> |
<view class="name">{{ form.customerName }}</view> |
||||||
<view class="text">客户类型:{{ customerType }}</view> |
<view class="text">客户类型:{{ customerType }}</view> |
||||||
<view class="text">产品到期时间:{{ form.expireDate || '' }}</view> |
<view class="text">产品到期时间:{{ form.expireDate || '' }}</view> |
||||||
</view> |
</view> |
||||||
</uni-card> |
</uni-card> |
||||||
|
|
||||||
<view class="block"> |
<view class="block"> |
||||||
<view class="l-title">基本信息</view> |
<view class="l-title">基本信息</view> |
||||||
<view class="form-list"> |
<view class="form-list"> |
||||||
<view class="line req"> |
<view class="line req"> |
||||||
<view class="name">客户名称</view> |
<view class="name">客户名称</view> |
||||||
<view v-if="isDetail" class="val">{{ form.customerName }}</view> |
<view v-if="isDetail" class="val">{{ form.customerName }}</view> |
||||||
<view v-else :class="['ph', {val: form.customerName}]" @click="schoolVisible = true">{{ form.customerName || '请选择学校' }}</view> |
<view v-else :class="['ph', {val: form.customerName}]" @click="schoolVisible = true">{{ form.customerName || '请选择学校' }}</view> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">省份</view> |
<view class="name">省份</view> |
||||||
<view class="val">{{ form.provinceName }}</view> |
<view class="val">{{ form.provinceName }}</view> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">城市</view> |
<view class="name">城市</view> |
||||||
<view class="val">{{ form.cityName }}</view> |
<view class="val">{{ form.cityName }}</view> |
||||||
</view> |
</view> |
||||||
<view class="line req"> |
<view class="line req"> |
||||||
<view class="name">行业类型</view> |
<view class="name">行业类型</view> |
||||||
<view v-if="isDetail" class="val">{{ form.industryClassName }}</view> |
<view v-if="isDetail" class="val">{{ form.industryClassName }}</view> |
||||||
<uni-data-picker v-else class="picker-input" placeholder="请选择行业类型" popup-title="请选择行业类型" preload :clear-icon="false" :localdata="industryClassList" :map="{text: 'industryClassName', value: 'industryClassId'}" v-model="form.industryClassId" @change="industryClassChange"></uni-data-picker> |
<uni-data-picker v-else class="picker-input" placeholder="请选择行业类型" popup-title="请选择行业类型" preload :clear-icon="false" :localdata="industryClassList" :map="{text: 'industryClassName', value: 'industryClassId'}" v-model="form.industryClassId" @change="industryClassChange"></uni-data-picker> |
||||||
</view> |
</view> |
||||||
<view class="line req"> |
<view class="line req"> |
||||||
<view class="name">行业</view> |
<view class="name">行业</view> |
||||||
<view v-if="isDetail" class="val">{{ form.industryName }}</view> |
<view v-if="isDetail" class="val">{{ form.industryName }}</view> |
||||||
<uni-data-picker v-else class="picker-input" placeholder="请选择行业" popup-title="请选择行业" preload :clear-icon="false" :localdata="industryList" :map="{text: 'industryName', value: 'industryId'}" v-model="form.industryId" :readonly="form.industryClassId ? false : true"></uni-data-picker> |
<uni-data-picker v-else class="picker-input" placeholder="请选择行业" popup-title="请选择行业" preload :clear-icon="false" :localdata="industryList" :map="{text: 'industryName', value: 'industryId'}" v-model="form.industryId" :readonly="form.industryClassId ? false : true"></uni-data-picker> |
||||||
</view> |
</view> |
||||||
<view class="line req"> |
<view class="line req"> |
||||||
<view class="name">联系人姓名</view> |
<view class="name">联系人姓名</view> |
||||||
<view v-if="isDetail" class="val">{{ form.name }}</view> |
<view v-if="isDetail" class="val">{{ form.name }}</view> |
||||||
<input v-else type="text" v-model="form.name"> |
<input v-else type="text" v-model="form.name"> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">手机</view> |
<view class="name">手机</view> |
||||||
<view v-if="isDetail" class="val">{{ form.phone }}</view> |
<view v-if="isDetail" class="val">{{ form.phone }}</view> |
||||||
<input v-else type="text" v-model="form.phone"> |
<input v-else type="text" maxlength="11" v-model="form.phone"> |
||||||
</view> |
</view> |
||||||
<view class="line req"> |
<view class="line req"> |
||||||
<view class="name">账号</view> |
<view class="name">账号</view> |
||||||
<view v-if="isDetail" class="val">{{ form.account }}</view> |
<view v-if="isDetail" class="val">{{ form.account }}</view> |
||||||
<input v-else type="text" placeholder="请以院校首字母+admin的格式来设置" v-model="form.account"> |
<input v-else type="text" placeholder="请以院校首字母+admin的格式来设置" v-model="form.account"> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">职务</view> |
<view class="name">职务</view> |
||||||
<view v-if="isDetail" class="val">{{ form.position }}</view> |
<view v-if="isDetail" class="val">{{ form.position }}</view> |
||||||
<input v-else type="text" v-model="form.position"> |
<input v-else type="text" v-model="form.position"> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">邮箱</view> |
<view class="name">邮箱</view> |
||||||
<view v-if="isDetail" class="val">{{ form.email }}</view> |
<view v-if="isDetail" class="val">{{ form.email }}</view> |
||||||
<input v-else type="text" v-model="form.email"> |
<input v-else type="text" v-model="form.email"> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">产品到期时间</view> |
<view class="name">产品到期时间</view> |
||||||
<view class="val">{{ form.expireDate }}</view> |
<view class="val">{{ form.expireDate }}</view> |
||||||
</view> |
</view> |
||||||
<view class="line"> |
<view class="line"> |
||||||
<view class="name">客户类型</view> |
<view class="name">客户类型</view> |
||||||
<view class="val">{{ customerType }}</view> |
<view class="val">{{ customerType }}</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
|
|
||||||
<view class="action" v-if="isDetail"> |
<view v-if="isDetail" class="action"> |
||||||
<view class="item" @click="toPage(`../clientDetail/clientDetail?customerId=${customerId}`)"> |
<view class="item" @click="toPage(`../clientDetail/clientDetail?customerId=${customerId}`)"> |
||||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="20" color="#959595"></uni-icons> |
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="20" color="#959595"></uni-icons> |
||||||
<view class="text">编辑</view> |
<view class="text">编辑</view> |
||||||
</view> |
</view> |
||||||
<view class="item" @click="toPage(`../ordered/ordered?customerId=${customerId}`)"> |
<view class="item" @click="toPage(`../ordered/ordered?customerId=${customerId}`)"> |
||||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="20" color="#959595"></uni-icons> |
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="20" color="#959595"></uni-icons> |
||||||
<view class="text">已订阅产品</view> |
<view class="text">已订阅产品</view> |
||||||
</view> |
</view> |
||||||
<view class="item" @click="toPage('../orders/orders')"> |
<view class="item" @click="toPage('../orders/orders')"> |
||||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-dingdan" size="20" color="#959595"></uni-icons> |
<uni-icons class="icon" custom-prefix="iconfont" type="icon-dingdan" size="20" color="#959595"></uni-icons> |
||||||
<view class="text">订单</view> |
<view class="text">订单</view> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
|
<view v-else class="btn-wrap"> |
||||||
<view class="popup-mask" v-show="schoolVisible" @click="closeSchool"></view> |
<view class="btn" @click="submit">确定</view> |
||||||
<view class="popup" v-show="schoolVisible"> |
</view> |
||||||
<view class="top">请选择学校</view> |
|
||||||
<uni-icons class="close" type="closeempty" size="20" @click="closeSchool"></uni-icons> |
<view class="popup-mask" v-show="schoolVisible" @click="closeSchool"></view> |
||||||
<uni-search-bar class="search" radius="5" placeholder="请输入学校名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
<view class="popup" v-show="schoolVisible"> |
||||||
<view class="list"> |
<view class="top">请选择学校</view> |
||||||
<view class="item" v-for="item in schoolList" @click="schoolChange(item)">{{ item.schoolName }}</view> |
<uni-icons class="close" type="closeempty" size="20" @click="closeSchool"></uni-icons> |
||||||
</view> |
<uni-search-bar class="search" radius="5" placeholder="请输入学校名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
||||||
</view> |
<view class="list"> |
||||||
</view> |
<view class="item" v-for="item in schoolList" @click="schoolChange(item)">{{ item.schoolName }}</view> |
||||||
</template> |
</view> |
||||||
|
</view> |
||||||
<script> |
</view> |
||||||
import { queryCustomerDetails, querySchool, queryIndustryClass, queryIndustry, queryCustomerIsExists, addCustomer, updateCustomer } from '@/apis/modules/client.js' |
</template> |
||||||
export default { |
|
||||||
data() { |
<script> |
||||||
return { |
import { queryCustomerDetails, querySchool, queryIndustryClass, queryIndustry, queryCustomerIsExists, addCustomer, updateCustomer } from '@/apis/modules/client.js' |
||||||
isDetail: false, |
export default { |
||||||
customerId: '', |
data() { |
||||||
// 客户类型 |
return { |
||||||
customerTypeList: [{ |
isDetail: false, |
||||||
name: '正式', |
customerId: '', |
||||||
value: 1 |
// 客户类型 |
||||||
}, |
customerTypeList: [{ |
||||||
{ |
name: '正式', |
||||||
name: '试用', |
value: 1 |
||||||
value: 2 |
}, |
||||||
}, |
{ |
||||||
{ |
name: '试用', |
||||||
name: '到期', |
value: 2 |
||||||
value: 3 |
}, |
||||||
}], |
{ |
||||||
nameRepeat: false, |
name: '到期', |
||||||
schoolVisible: false, |
value: 3 |
||||||
keyword: '', |
}], |
||||||
searchTimer: null, |
nameRepeat: false, |
||||||
schoolList: [], |
schoolVisible: false, |
||||||
schoolListAll: [], |
keyword: '', |
||||||
industryClassList: [], |
searchTimer: null, |
||||||
industryList: [], |
schoolList: [], |
||||||
form: { |
schoolListAll: [], |
||||||
countries: '中国', |
industryClassList: [], |
||||||
customerId: '', |
industryList: [], |
||||||
customerName: '', |
form: { |
||||||
industryClassId: '', |
countries: '中国', |
||||||
industryId: '', |
customerId: '', |
||||||
provinceId: '', |
customerName: '', |
||||||
provinceName: '', |
industryClassId: '', |
||||||
account: '', |
industryId: '', |
||||||
name: '', |
provinceId: '', |
||||||
phone: '', |
provinceName: '', |
||||||
position: '', |
account: '', |
||||||
cityId: '', |
name: '', |
||||||
cityName: '', |
phone: '', |
||||||
customerType: '', |
position: '', |
||||||
expireDate: '', |
cityId: '', |
||||||
email: '', |
cityName: '', |
||||||
schoolId: '' |
customerType: '', |
||||||
}, |
expireDate: '', |
||||||
customerType: '', |
email: '', |
||||||
} |
schoolId: '' |
||||||
|
}, |
||||||
|
customerType: '', |
||||||
|
} |
||||||
}, |
}, |
||||||
watch: { |
watch: { |
||||||
keyword () { |
keyword () { |
||||||
clearTimeout(this.searchTimer) |
clearTimeout(this.searchTimer) |
||||||
this.searchTimer = setTimeout(() => { |
this.searchTimer = setTimeout(() => { |
||||||
this.filterSchool() |
this.filterSchool() |
||||||
}, 500) |
}, 500) |
||||||
} |
} |
||||||
}, |
}, |
||||||
onLoad(option) { |
onLoad(option) { |
||||||
this.customerId = option.customerId |
this.customerId = option.customerId |
||||||
this.isDetail = !!option.show |
this.isDetail = !!option.show |
||||||
|
|
||||||
option.customerId && this.getInfo() |
option.customerId && this.getInfo() |
||||||
// 非详情才需要查询学校和行业 |
// 非详情才需要查询学校和行业 |
||||||
if (!this.isDetail) { |
if (!this.isDetail) { |
||||||
this.getSchool() |
this.getSchool() |
||||||
this.getIndustryClass() |
this.getIndustryClass() |
||||||
} |
} |
||||||
// 设置标题 |
// 设置标题 |
||||||
uni.setNavigationBarTitle({ |
uni.setNavigationBarTitle({ |
||||||
title: option.customerId ? |
title: option.customerId ? |
||||||
(option.show ? |
(option.show ? |
||||||
'客户详情' : |
'客户详情' : |
||||||
'编辑客户') : |
'编辑客户') : |
||||||
'新增客户' |
'新增客户' |
||||||
}) |
}) |
||||||
}, |
}, |
||||||
methods: { |
methods: { |
||||||
// 获取详情 |
// 获取详情 |
||||||
getInfo() { |
getInfo() { |
||||||
queryCustomerDetails({ |
queryCustomerDetails({ |
||||||
customerId: this.customerId |
customerId: this.customerId |
||||||
}).then(({ result }) => { |
}).then(({ result }) => { |
||||||
const { customer } = result |
const { customer } = result |
||||||
this.form = customer |
this.form = customer |
||||||
this.$refs.nameInput.val = customer.name |
this.$refs.nameInput.val = customer.name |
||||||
this.$refs.phoneInput.val = customer.phone |
this.$refs.phoneInput.val = customer.phone |
||||||
this.$refs.accountInput.val = customer.account |
this.$refs.accountInput.val = customer.account |
||||||
this.$refs.positionInput.val = customer.position |
this.$refs.positionInput.val = customer.position |
||||||
this.$refs.emailInput.val = customer.email |
this.$refs.emailInput.val = customer.email |
||||||
this.customerType = this.customerTypeList.find(e => e.value === customer.customerType).name |
this.customerType = this.customerTypeList.find(e => e.value === customer.customerType).name |
||||||
}).catch(e => {}) |
}).catch(e => {}) |
||||||
}, |
}, |
||||||
// 获取学校列表 |
// 获取学校列表 |
||||||
getSchool() { |
getSchool() { |
||||||
querySchool({ |
querySchool({ |
||||||
schoolName: '', |
schoolName: '', |
||||||
provinceId: '', |
provinceId: '', |
||||||
cityId: '' |
cityId: '' |
||||||
}).then(({ list }) => { |
}).then(({ list }) => { |
||||||
this.schoolListAll = list |
this.schoolListAll = list |
||||||
this.schoolList = list |
this.schoolList = list |
||||||
}).catch(res => {}) |
}).catch(res => {}) |
||||||
}, |
}, |
||||||
// 学校模糊匹配 |
// 学校模糊匹配 |
||||||
filterSchool() { |
filterSchool() { |
||||||
const { keyword } = this |
const { keyword } = this |
||||||
this.schoolList = keyword ? |
this.schoolList = keyword ? |
||||||
this.schoolListAll.filter(e => e.schoolName.includes(keyword)) : |
this.schoolListAll.filter(e => e.schoolName.includes(keyword)) : |
||||||
this.schoolListAll |
this.schoolListAll |
||||||
}, |
}, |
||||||
// 关闭学校弹框 |
// 关闭学校弹框 |
||||||
closeSchool() { |
closeSchool() { |
||||||
this.schoolVisible = false |
this.schoolVisible = false |
||||||
this.keyword = '' |
this.keyword = '' |
||||||
}, |
}, |
||||||
// 客户名称选择回调 |
// 客户名称选择回调 |
||||||
schoolChange(school) { |
schoolChange(school) { |
||||||
const { form } = this |
const { form } = this |
||||||
const { schoolId } = form |
const { schoolId } = form |
||||||
form.schoolId = school.schoolId |
form.schoolId = school.schoolId |
||||||
form.customerName = school.schoolName |
form.customerName = school.schoolName |
||||||
form.provinceId = school.provinceId |
form.provinceId = school.provinceId |
||||||
form.provinceName = school.provinceName |
form.provinceName = school.provinceName |
||||||
form.cityId = school.cityId |
form.cityId = school.cityId |
||||||
form.cityName = school.cityName |
form.cityName = school.cityName |
||||||
this.closeSchool() |
this.closeSchool() |
||||||
// 客户名称判重 |
// 客户名称判重 |
||||||
queryCustomerIsExists({ |
queryCustomerIsExists({ |
||||||
schoolId |
schoolId |
||||||
}).then(res => { |
}).then(res => { |
||||||
this.nameRepeat = false |
this.nameRepeat = false |
||||||
}).catch(res => { |
}).catch(res => { |
||||||
this.nameRepeat = true |
this.nameRepeat = true |
||||||
}) |
}) |
||||||
}, |
}, |
||||||
// 获取行业类 |
// 获取行业类 |
||||||
getIndustryClass() { |
getIndustryClass() { |
||||||
queryIndustryClass().then(({ list }) => { |
queryIndustryClass().then(({ list }) => { |
||||||
this.industryClassList = list |
this.industryClassList = list |
||||||
}).catch(res => {}) |
}).catch(res => {}) |
||||||
}, |
}, |
||||||
// 行业分类选择回调 |
// 行业分类选择回调 |
||||||
industryClassChange() { |
industryClassChange() { |
||||||
this.getIndustry() |
this.getIndustry() |
||||||
}, |
}, |
||||||
// 获取行业 |
// 获取行业 |
||||||
getIndustry() { |
getIndustry() { |
||||||
queryIndustry({ |
queryIndustry({ |
||||||
industryClassId: this.form.industryClassId |
industryClassId: this.form.industryClassId |
||||||
}).then(({ list }) => { |
}).then(({ list }) => { |
||||||
this.industryList = list |
this.industryList = list |
||||||
}).catch(res => {}) |
}).catch(res => {}) |
||||||
}, |
}, |
||||||
// 跳转 |
// 跳转 |
||||||
toPage(path) { |
toPage(path) { |
||||||
this.$util.to(path) |
this.$util.to(path) |
||||||
}, |
}, |
||||||
// 提交 |
// 提交 |
||||||
submit() { |
submit() { |
||||||
const refs = this.$refs |
const refs = this.$refs |
||||||
const { form } = this |
const { form } = this |
||||||
// 有大量数据的情况下,input输入用v-model会有bug,所以给每个input加ref来手动取值赋值 |
const { schoolId, industryClassId, industryId, name, account } = form |
||||||
form.name = refs.nameInput.val |
if (!schoolId) return this.$util.errMsg('请选择客户!')
if (this.nameRepeat) return this.$util.errMsg('客户已存在!')
if (!industryClassId) return this.$util.errMsg('请选择行业类型!')
if (!industryId) return this.$util.errMsg('请选择行业!')
if (!name) return this.$util.errMsg('请输入联系人姓名!')
if (!account) return this.$util.errMsg('请输入账号!') |
||||||
form.account = refs.accountInput.val |
if (this.customerId) { |
||||||
form.position = refs.positionInput.val |
updateCustomer(form).then(res => { |
||||||
form.phone = refs.phoneInput.val |
this.$util.sucMsg('编辑成功') |
||||||
form.email = refs.emailInput.val |
setTimeout(() => { |
||||||
this.$nextTick(() => { |
this.$util.to('../clients/clients') |
||||||
this.$refs.form.validate().then(res => { |
}, 1500) |
||||||
if (this.nameRepeat) return this.$util.errMsg('客户已存在!') |
}).catch(res => {}) |
||||||
if (this.customerId) { |
} else { |
||||||
updateCustomer(form).then(res => { |
addCustomer(form).then(res => { |
||||||
this.$util.sucMsg('编辑成功') |
this.$util.sucMsg('添加成功') |
||||||
setTimeout(() => { |
setTimeout(() => { |
||||||
this.$util.to('../clients/clients') |
uni.navigateBack() |
||||||
}, 1500) |
}, 1500) |
||||||
}).catch(res => {}) |
}).catch(res => {}) |
||||||
} else { |
} |
||||||
addCustomer(form).then(res => { |
}, |
||||||
this.$util.sucMsg('添加成功') |
} |
||||||
setTimeout(() => { |
} |
||||||
uni.navigateBack() |
</script> |
||||||
}, 1500) |
|
||||||
}).catch(res => {}) |
<style scoped lang="scss"> |
||||||
} |
.page { |
||||||
}).catch(err => {}) |
padding-bottom: 150rpx; |
||||||
}) |
} |
||||||
}, |
.info { |
||||||
} |
.name { |
||||||
} |
margin-bottom: 5px; |
||||||
</script> |
font-size: 16px; |
||||||
|
color: #333; |
||||||
<style scoped lang="scss"> |
} |
||||||
.page { |
} |
||||||
padding-bottom: 55px; |
.action { |
||||||
} |
z-index: 2; |
||||||
.info { |
position: fixed; |
||||||
.name { |
bottom: 0; |
||||||
margin-bottom: 5px; |
display: flex; |
||||||
font-size: 16px; |
justify-content: space-around; |
||||||
color: #333; |
width: 100%; |
||||||
} |
padding: 5px 10px; |
||||||
} |
background-color: #fff; |
||||||
.action { |
border-top: 1px solid #f3f3f3; |
||||||
z-index: 2; |
box-sizing: border-box; |
||||||
position: fixed; |
.item { |
||||||
bottom: 0; |
text-align: center; |
||||||
display: flex; |
} |
||||||
justify-content: space-around; |
.text { |
||||||
width: 100%; |
font-size: 10px; |
||||||
padding: 5px 10px; |
color: #959595; |
||||||
background-color: #fff; |
} |
||||||
border-top: 1px solid #f3f3f3; |
} |
||||||
.item { |
</style> |
||||||
text-align: center; |
|
||||||
} |
|
||||||
.text { |
|
||||||
font-size: 10px; |
|
||||||
color: #959595; |
|
||||||
} |
|
||||||
} |
|
||||||
</style> |
|
||||||
|
@ -0,0 +1,265 @@ |
|||||||
|
<template> |
||||||
|
<view class="page"> |
||||||
|
<view class="block"> |
||||||
|
<view class="l-title">基本信息</view> |
||||||
|
<uni-icons class="arrow" type="top" size="20" color="#007EFF"></uni-icons> |
||||||
|
<view v-for="(item, i) in courses"> |
||||||
|
<view class="pro-name"> |
||||||
|
<view class="left"> |
||||||
|
<image class="icon" src="../../static/image/course1.png" mode=""></image> |
||||||
|
{{ item.productName }} |
||||||
|
</view> |
||||||
|
<uni-icons class="del" type="trash" size="25" color="#ADADAD" @click="delCourse(i)"></uni-icons> |
||||||
|
</view> |
||||||
|
<view class="form-list"> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">产品类型</view> |
||||||
|
<view class="val">{{ item.provinceName }}</view> |
||||||
|
</view> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">使用期限</view> |
||||||
|
<input type="text" v-model="item.periodOfUse" placeholder="请输入" @change="calcDate(item)"> |
||||||
|
</view> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">使用期限单位</view> |
||||||
|
<uni-data-picker class="picker-input" placeholder="请选择" popup-title="请选择" preload :clear-icon="false" :localdata="units" v-model="item.options" @change="calcDate(item)"></uni-data-picker> |
||||||
|
</view> |
||||||
|
<view class="line req"> |
||||||
|
<view class="name">起止日期</view> |
||||||
|
<uni-datetime-picker type="date" v-model="item.startTime" :border="false"> |
||||||
|
<view :class="['ph', {val: item.startTime}]"> |
||||||
|
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} |
||||||
|
</view> |
||||||
|
</uni-datetime-picker> |
||||||
|
</view> |
||||||
|
<view class="line req"> |
||||||
|
<view class="name">数量</view> |
||||||
|
<view v-if="item.authority" class="val">1</view> |
||||||
|
<input v-else type="text" v-model="item.accountNum" placeholder="请输入" @change="calcFinalPrice(item)"> |
||||||
|
</view> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">{{ item.authority ? '市场价' : '市场单价' }}</view> |
||||||
|
<view class="val">{{ item.marketValue }}元</view> |
||||||
|
</view> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">结算价</view> |
||||||
|
<view class="val">{{ item.settlementPrice }}元</view> |
||||||
|
</view> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">折扣率</view> |
||||||
|
<view class="val">{{ item.discountRate }}</view> |
||||||
|
</view> |
||||||
|
<view class="line"> |
||||||
|
<view class="name">平台服务费</view> |
||||||
|
<view class="val">元</view> |
||||||
|
</view> |
||||||
|
<view class="line req"> |
||||||
|
<view class="name">成交价</view> |
||||||
|
<view class="inline"> |
||||||
|
<input type="text" v-model="item.finalPrice" placeholder="请输入" @change="calcFinalValue(item)"> |
||||||
|
元 |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<view class="btn-wrap"> |
||||||
|
<view class="btn" @click="submit">确定</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
units: [{ |
||||||
|
text: '日', |
||||||
|
value: 0 |
||||||
|
}, { |
||||||
|
text: '月', |
||||||
|
value: 1 |
||||||
|
}, { |
||||||
|
text: '年', |
||||||
|
value: 2 |
||||||
|
}], |
||||||
|
courses: uni.getStorageSync('courses') // 上一页缓存的产品 |
||||||
|
} |
||||||
|
}, |
||||||
|
onLoad(option) { |
||||||
|
|
||||||
|
}, |
||||||
|
methods: { |
||||||
|
// 删除课程 |
||||||
|
delCourse(i) { |
||||||
|
const that = this |
||||||
|
uni.showModal({ |
||||||
|
title: '提示', |
||||||
|
content: '确定要删除吗?', |
||||||
|
success(res) { |
||||||
|
res.confirm && that.courses.splice(i, 1) |
||||||
|
} |
||||||
|
}) |
||||||
|
}, |
||||||
|
// 使用期限转换以及计算剩余天数 |
||||||
|
calcDate(row) { |
||||||
|
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()) |
||||||
|
const unit = row.options // 使用期限单位 |
||||||
|
const useUnit = row.periodOfUse // 使用期限 |
||||||
|
// 计算市场价(课程才需要) |
||||||
|
if (row.authority) { |
||||||
|
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 (isDate) { |
||||||
|
// const cId = row.dataOrCourseId |
||||||
|
// const date = new Date(row.startTime) |
||||||
|
// const orderRepeat = this.orderRepeat |
||||||
|
// this.$post(this.api.getOrderOtherTime, { |
||||||
|
// customerId: this.form.customerId, |
||||||
|
// id: row.dataOrCourseId, |
||||||
|
// startTime: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(), |
||||||
|
// 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 = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}` |
||||||
|
// } |
||||||
|
// }).catch(res => { |
||||||
|
// this.repeatMsg = res.message |
||||||
|
// orderRepeat.includes(cId) || orderRepeat.push(cId) |
||||||
|
// }) |
||||||
|
// } |
||||||
|
// 折扣率 |
||||||
|
this.calcDiscount(row) |
||||||
|
}, |
||||||
|
// 计算结算价及平台服务费 |
||||||
|
dealSettlePrice(row) { |
||||||
|
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 |
||||||
|
} |
||||||
|
row.settlementPrice = this.$util.handleNaN(sPrice) |
||||||
|
// 平台服务费(结算价*10%) |
||||||
|
if (row.settlementPrice) { |
||||||
|
// row. |
||||||
|
} |
||||||
|
}, |
||||||
|
// 计算折扣率 |
||||||
|
calcDiscount(row) { |
||||||
|
const price = row.authority ? row.finalPrice : row.finalValue |
||||||
|
const { marketValue } = row |
||||||
|
// 课程:成交价/市场价;数据:成交单价/市场单价 |
||||||
|
if (price) row.discountRate = marketValue != 0 ? (price / row.marketValue * 100).toFixed(2) + '%' : '0%' |
||||||
|
}, |
||||||
|
// 成交价修改后,计算成交单价,数据才需要 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
||||||
|
calcFinalValue(row) { |
||||||
|
const { authority, periodOfUse, options, accountNum, finalPrice } = row |
||||||
|
if (authority && periodOfUse && accountNum && finalPrice) { |
||||||
|
row.finalValue = (finalPrice / accountNum / periodOfUse * (!options ? |
||||||
|
365 : |
||||||
|
options === 1 ? |
||||||
|
12 : |
||||||
|
1)).toFixed(2) |
||||||
|
} |
||||||
|
// 折扣率 |
||||||
|
this.calcDiscount(row) |
||||||
|
}, |
||||||
|
// 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
||||||
|
calcFinalPrice(row) { |
||||||
|
const { finalValue, accountNum, periodOfUse, options } = row |
||||||
|
if (finalValue && accountNum) { |
||||||
|
row.finalPrice = ((!options ? |
||||||
|
finalValue / 365 * periodOfUse : |
||||||
|
options === 1 ? |
||||||
|
finalValue / 12 * periodOfUse : |
||||||
|
finalValue * periodOfUse) * accountNum).toFixed(2) |
||||||
|
} |
||||||
|
}, |
||||||
|
// 确定 |
||||||
|
submit() { |
||||||
|
uni.setStorageSync('courses', this.courses) |
||||||
|
uni.navigateBack() |
||||||
|
}, |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped lang="scss"> |
||||||
|
.page { |
||||||
|
height: calc(100vh - 140rpx); |
||||||
|
overflow: auto; |
||||||
|
} |
||||||
|
.block { |
||||||
|
position: relative; |
||||||
|
padding: 0; |
||||||
|
.l-title { |
||||||
|
margin: 0 24rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
.arrow { |
||||||
|
position: absolute; |
||||||
|
top: 30rpx; |
||||||
|
right: 30rpx; |
||||||
|
} |
||||||
|
.pro-name { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
align-items: center; |
||||||
|
padding: 14rpx 24rpx; |
||||||
|
font-size: 30rpx; |
||||||
|
color: #333; |
||||||
|
background: linear-gradient(90deg, #FFF5E5 0%, #FFFFFF 100%); |
||||||
|
.left { |
||||||
|
display: inline-flex; |
||||||
|
align-items: center; |
||||||
|
} |
||||||
|
.icon { |
||||||
|
width: 60rpx; |
||||||
|
height: 60rpx; |
||||||
|
margin-right: 12rpx; |
||||||
|
border-radius: 10rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
.form-list { |
||||||
|
padding: 0 24rpx; |
||||||
|
border-top: 0; |
||||||
|
} |
||||||
|
</style> |
After Width: | Height: | Size: 27 KiB |
Loading…
Reference in new issue