订单相关

master
yujialong 3 years ago
parent 92e4cd7bd9
commit bd81608900
  1. 6
      apis/modules/course.js
  2. 2
      apis/request.js
  3. 34
      components/empty/empty.vue
  4. 26
      libs/util.js
  5. 73
      pages.json
  6. 201
      pages/addCourse/addCourse.vue
  7. 182
      pages/addOrder/addOrder.vue
  8. 633
      pages/clientDetail/clientDetail.vue
  9. 265
      pages/editCourse/editCourse.vue
  10. 120
      pages/orderDetail/orderDetail.vue
  11. 44
      pages/orders/orders.vue
  12. BIN
      static/image/none.png
  13. 30
      styles/common.scss

@ -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)
}

@ -12,7 +12,7 @@ const request = options => {
})
}
const header = Object.assign({}, config.headers, {
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjUzMzU5NTQwLCJleHAiOjE2NTM0MDI3NDAsImFjY291bnRJZCI6IjEifQ._dqfOSY8Gr6O0BFXxP17CI7zzJY9MHmfzj3876zc21s'
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjUzNTMwODYyLCJleHAiOjE2NTM1NzQwNjIsImFjY291bnRJZCI6IjEifQ.ZFU5-NtjHBxKLcKUo6OuIrM8Na9HYQB6SqQSd4ZkXbo'
})
return new Promise((resolve, reject)=>{
uni.request({

@ -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>

@ -17,5 +17,31 @@ export default {
title,
icon: 'none'
})
},
// 如果非数字,则返回0
handleNaN(val) {
return isNaN(val) ? 0 : val
},
//返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss"
formatDate(date, fmt = 'yyyy-MM-dd hh:mm:ss') {
var date = date ? date : new Date()
var o = {
"M+" : date.getMonth()+1, //月份
"d+" : date.getDate(), //日
"h+" : date.getHours(), //小时
"m+" : date.getMinutes(), //分
"s+" : date.getSeconds(), //秒
"q+" : Math.floor((date.getMonth()+3)/3), //季度
"S" : date.getMilliseconds() //毫秒
}
if(/(y+)/.test(fmt)) {
fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length))
}
for(var k in o) {
if(new RegExp("("+ k +")").test(fmt)){
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)))
}
}
return fmt
}
}

@ -1,5 +1,13 @@
{
"pages": [
{
"path" : "pages/orders/orders",
"style" :
{
"navigationBarTitleText": "订单列表",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/clients/clients",
"style" :
@ -7,6 +15,22 @@
"navigationBarTitleText": "客户列表",
"enablePullDownRefresh": true
}
},
{
"path" : "pages/clientDetail/clientDetail",
"style" :
{
"navigationBarTitleText": "客户详情",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/orderDetail/orderDetail",
"style" :
{
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/index",
@ -30,22 +54,6 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/orderDetail/orderDetail",
"style" :
{
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/clientDetail/clientDetail",
"style" :
{
"navigationBarTitleText": "客户详情",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/addMember/addMember",
"style" :
@ -61,14 +69,6 @@
"navigationBarTitleText": "添加成员",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/orders/orders",
"style" :
{
"navigationBarTitleText": "订单列表",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/plans/plans",
@ -126,14 +126,6 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/addOrder/addOrder",
"style" :
{
"navigationBarTitleText": "新建订单",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/ordered/ordered",
"style" :
@ -141,7 +133,6 @@
"navigationBarTitleText": "已订阅产品",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/detail/detail",
@ -151,6 +142,22 @@
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/addCourse/addCourse",
"style" :
{
"navigationBarTitleText": "选择产品",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/editCourse/editCourse",
"style" :
{
"navigationBarTitleText": "编辑产品",
"enablePullDownRefresh": false
}
}
],
"condition": { //
"current": 0, //list

@ -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, // 10
ship: 0, // 01
authority: 1, // 01
options: 1,
settlementPrice: '', //
settlementMethod: e.settlementMethod, // 01
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>
<view :class="{page: isDetail}">
<uni-card v-if="customerId" :is-shadow="false" :border="false" is-full>
<view class="info">
<view class="name">{{ form.customerName }}</view>
<view class="text">客户类型{{ customerType }}</view>
<view class="text">产品到期时间{{ form.expireDate || '' }}</view>
</view>
</uni-card>
<view class="block">
<view class="l-title">基本信息</view>
<view class="form-list">
<view class="line req">
<view class="name">客户名称</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>
<view class="line">
<view class="name">省份</view>
<view class="val">{{ form.provinceName }}</view>
</view>
<view class="line">
<view class="name">城市</view>
<view class="val">{{ form.cityName }}</view>
</view>
<view class="line req">
<view class="name">行业类型</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>
</view>
<view class="line req">
<view class="name">行业</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>
</view>
<view class="line req">
<view class="name">联系人姓名</view>
<view v-if="isDetail" class="val">{{ form.name }}</view>
<input v-else type="text" v-model="form.name">
</view>
<view class="line">
<view class="name">手机</view>
<view v-if="isDetail" class="val">{{ form.phone }}</view>
<input v-else type="text" v-model="form.phone">
</view>
<view class="line req">
<view class="name">账号</view>
<view v-if="isDetail" class="val">{{ form.account }}</view>
<input v-else type="text" placeholder="请以院校首字母+admin的格式来设置" v-model="form.account">
</view>
<view class="line">
<view class="name">职务</view>
<view v-if="isDetail" class="val">{{ form.position }}</view>
<input v-else type="text" v-model="form.position">
</view>
<view class="line">
<view class="name">邮箱</view>
<view v-if="isDetail" class="val">{{ form.email }}</view>
<input v-else type="text" v-model="form.email">
</view>
<view class="line">
<view class="name">产品到期时间</view>
<view class="val">{{ form.expireDate }}</view>
</view>
<view class="line">
<view class="name">客户类型</view>
<view class="val">{{ customerType }}</view>
</view>
</view>
</view>
<view class="action" v-if="isDetail">
<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>
<view class="text">编辑</view>
</view>
<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>
<view class="text">已订阅产品</view>
</view>
<view class="item" @click="toPage('../orders/orders')">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-dingdan" size="20" color="#959595"></uni-icons>
<view class="text">订单</view>
</view>
</view>
<view class="popup-mask" v-show="schoolVisible" @click="closeSchool"></view>
<view class="popup" v-show="schoolVisible">
<view class="top">请选择学校</view>
<uni-icons class="close" type="closeempty" size="20" @click="closeSchool"></uni-icons>
<uni-search-bar class="search" radius="5" placeholder="请输入学校名称" v-model="keyword" clearButton="auto" cancelButton="none" />
<view class="list">
<view class="item" v-for="item in schoolList" @click="schoolChange(item)">{{ item.schoolName }}</view>
</view>
</view>
</view>
</template>
<script>
import { queryCustomerDetails, querySchool, queryIndustryClass, queryIndustry, queryCustomerIsExists, addCustomer, updateCustomer } from '@/apis/modules/client.js'
export default {
data() {
return {
isDetail: false,
customerId: '',
//
customerTypeList: [{
name: '正式',
value: 1
},
{
name: '试用',
value: 2
},
{
name: '到期',
value: 3
}],
nameRepeat: false,
schoolVisible: false,
keyword: '',
searchTimer: null,
schoolList: [],
schoolListAll: [],
industryClassList: [],
industryList: [],
form: {
countries: '中国',
customerId: '',
customerName: '',
industryClassId: '',
industryId: '',
provinceId: '',
provinceName: '',
account: '',
name: '',
phone: '',
position: '',
cityId: '',
cityName: '',
customerType: '',
expireDate: '',
email: '',
schoolId: ''
},
customerType: '',
}
<template>
<view class="page">
<uni-card v-if="customerId" :is-shadow="false" :border="false" is-full>
<view class="info">
<view class="name">{{ form.customerName }}</view>
<view class="text">客户类型{{ customerType }}</view>
<view class="text">产品到期时间{{ form.expireDate || '' }}</view>
</view>
</uni-card>
<view class="block">
<view class="l-title">基本信息</view>
<view class="form-list">
<view class="line req">
<view class="name">客户名称</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>
<view class="line">
<view class="name">省份</view>
<view class="val">{{ form.provinceName }}</view>
</view>
<view class="line">
<view class="name">城市</view>
<view class="val">{{ form.cityName }}</view>
</view>
<view class="line req">
<view class="name">行业类型</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>
</view>
<view class="line req">
<view class="name">行业</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>
</view>
<view class="line req">
<view class="name">联系人姓名</view>
<view v-if="isDetail" class="val">{{ form.name }}</view>
<input v-else type="text" v-model="form.name">
</view>
<view class="line">
<view class="name">手机</view>
<view v-if="isDetail" class="val">{{ form.phone }}</view>
<input v-else type="text" maxlength="11" v-model="form.phone">
</view>
<view class="line req">
<view class="name">账号</view>
<view v-if="isDetail" class="val">{{ form.account }}</view>
<input v-else type="text" placeholder="请以院校首字母+admin的格式来设置" v-model="form.account">
</view>
<view class="line">
<view class="name">职务</view>
<view v-if="isDetail" class="val">{{ form.position }}</view>
<input v-else type="text" v-model="form.position">
</view>
<view class="line">
<view class="name">邮箱</view>
<view v-if="isDetail" class="val">{{ form.email }}</view>
<input v-else type="text" v-model="form.email">
</view>
<view class="line">
<view class="name">产品到期时间</view>
<view class="val">{{ form.expireDate }}</view>
</view>
<view class="line">
<view class="name">客户类型</view>
<view class="val">{{ customerType }}</view>
</view>
</view>
</view>
<view v-if="isDetail" class="action">
<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>
<view class="text">编辑</view>
</view>
<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>
<view class="text">已订阅产品</view>
</view>
<view class="item" @click="toPage('../orders/orders')">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-dingdan" size="20" color="#959595"></uni-icons>
<view class="text">订单</view>
</view>
</view>
<view v-else class="btn-wrap">
<view class="btn" @click="submit">确定</view>
</view>
<view class="popup-mask" v-show="schoolVisible" @click="closeSchool"></view>
<view class="popup" v-show="schoolVisible">
<view class="top">请选择学校</view>
<uni-icons class="close" type="closeempty" size="20" @click="closeSchool"></uni-icons>
<uni-search-bar class="search" radius="5" placeholder="请输入学校名称" v-model="keyword" clearButton="auto" cancelButton="none" />
<view class="list">
<view class="item" v-for="item in schoolList" @click="schoolChange(item)">{{ item.schoolName }}</view>
</view>
</view>
</view>
</template>
<script>
import { queryCustomerDetails, querySchool, queryIndustryClass, queryIndustry, queryCustomerIsExists, addCustomer, updateCustomer } from '@/apis/modules/client.js'
export default {
data() {
return {
isDetail: false,
customerId: '',
//
customerTypeList: [{
name: '正式',
value: 1
},
{
name: '试用',
value: 2
},
{
name: '到期',
value: 3
}],
nameRepeat: false,
schoolVisible: false,
keyword: '',
searchTimer: null,
schoolList: [],
schoolListAll: [],
industryClassList: [],
industryList: [],
form: {
countries: '中国',
customerId: '',
customerName: '',
industryClassId: '',
industryId: '',
provinceId: '',
provinceName: '',
account: '',
name: '',
phone: '',
position: '',
cityId: '',
cityName: '',
customerType: '',
expireDate: '',
email: '',
schoolId: ''
},
customerType: '',
}
},
watch: {
keyword () {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.filterSchool()
keyword () {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.filterSchool()
}, 500)
}
},
onLoad(option) {
this.customerId = option.customerId
this.isDetail = !!option.show
option.customerId && this.getInfo()
//
if (!this.isDetail) {
this.getSchool()
this.getIndustryClass()
}
//
uni.setNavigationBarTitle({
title: option.customerId ?
(option.show ?
'客户详情' :
'编辑客户') :
'新增客户'
})
},
methods: {
//
getInfo() {
queryCustomerDetails({
customerId: this.customerId
}).then(({ result }) => {
const { customer } = result
this.form = customer
this.$refs.nameInput.val = customer.name
this.$refs.phoneInput.val = customer.phone
this.$refs.accountInput.val = customer.account
this.$refs.positionInput.val = customer.position
this.$refs.emailInput.val = customer.email
this.customerType = this.customerTypeList.find(e => e.value === customer.customerType).name
}).catch(e => {})
},
//
getSchool() {
querySchool({
schoolName: '',
provinceId: '',
cityId: ''
}).then(({ list }) => {
this.schoolListAll = list
this.schoolList = list
}).catch(res => {})
},
//
filterSchool() {
const { keyword } = this
this.schoolList = keyword ?
this.schoolListAll.filter(e => e.schoolName.includes(keyword)) :
this.schoolListAll
},
//
closeSchool() {
this.schoolVisible = false
this.keyword = ''
},
//
schoolChange(school) {
const { form } = this
const { schoolId } = form
form.schoolId = school.schoolId
form.customerName = school.schoolName
form.provinceId = school.provinceId
form.provinceName = school.provinceName
form.cityId = school.cityId
form.cityName = school.cityName
this.closeSchool()
//
queryCustomerIsExists({
schoolId
}).then(res => {
this.nameRepeat = false
}).catch(res => {
this.nameRepeat = true
})
},
//
getIndustryClass() {
queryIndustryClass().then(({ list }) => {
this.industryClassList = list
}).catch(res => {})
},
//
industryClassChange() {
this.getIndustry()
},
//
getIndustry() {
queryIndustry({
industryClassId: this.form.industryClassId
}).then(({ list }) => {
this.industryList = list
}).catch(res => {})
},
//
toPage(path) {
this.$util.to(path)
},
//
submit() {
const refs = this.$refs
const { form } = this
// inputv-modelbuginputref
form.name = refs.nameInput.val
form.account = refs.accountInput.val
form.position = refs.positionInput.val
form.phone = refs.phoneInput.val
form.email = refs.emailInput.val
this.$nextTick(() => {
this.$refs.form.validate().then(res => {
if (this.nameRepeat) return this.$util.errMsg('客户已存在!')
if (this.customerId) {
updateCustomer(form).then(res => {
this.$util.sucMsg('编辑成功')
setTimeout(() => {
this.$util.to('../clients/clients')
}, 1500)
}).catch(res => {})
} else {
addCustomer(form).then(res => {
this.$util.sucMsg('添加成功')
setTimeout(() => {
uni.navigateBack()
}, 1500)
}).catch(res => {})
}
}).catch(err => {})
})
},
}
}
</script>
<style scoped lang="scss">
.page {
padding-bottom: 55px;
}
.info {
.name {
margin-bottom: 5px;
font-size: 16px;
color: #333;
}
}
.action {
z-index: 2;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
width: 100%;
padding: 5px 10px;
background-color: #fff;
border-top: 1px solid #f3f3f3;
.item {
text-align: center;
}
.text {
font-size: 10px;
color: #959595;
}
}
</style>
}
},
onLoad(option) {
this.customerId = option.customerId
this.isDetail = !!option.show
option.customerId && this.getInfo()
//
if (!this.isDetail) {
this.getSchool()
this.getIndustryClass()
}
//
uni.setNavigationBarTitle({
title: option.customerId ?
(option.show ?
'客户详情' :
'编辑客户') :
'新增客户'
})
},
methods: {
//
getInfo() {
queryCustomerDetails({
customerId: this.customerId
}).then(({ result }) => {
const { customer } = result
this.form = customer
this.$refs.nameInput.val = customer.name
this.$refs.phoneInput.val = customer.phone
this.$refs.accountInput.val = customer.account
this.$refs.positionInput.val = customer.position
this.$refs.emailInput.val = customer.email
this.customerType = this.customerTypeList.find(e => e.value === customer.customerType).name
}).catch(e => {})
},
//
getSchool() {
querySchool({
schoolName: '',
provinceId: '',
cityId: ''
}).then(({ list }) => {
this.schoolListAll = list
this.schoolList = list
}).catch(res => {})
},
//
filterSchool() {
const { keyword } = this
this.schoolList = keyword ?
this.schoolListAll.filter(e => e.schoolName.includes(keyword)) :
this.schoolListAll
},
//
closeSchool() {
this.schoolVisible = false
this.keyword = ''
},
//
schoolChange(school) {
const { form } = this
const { schoolId } = form
form.schoolId = school.schoolId
form.customerName = school.schoolName
form.provinceId = school.provinceId
form.provinceName = school.provinceName
form.cityId = school.cityId
form.cityName = school.cityName
this.closeSchool()
//
queryCustomerIsExists({
schoolId
}).then(res => {
this.nameRepeat = false
}).catch(res => {
this.nameRepeat = true
})
},
//
getIndustryClass() {
queryIndustryClass().then(({ list }) => {
this.industryClassList = list
}).catch(res => {})
},
//
industryClassChange() {
this.getIndustry()
},
//
getIndustry() {
queryIndustry({
industryClassId: this.form.industryClassId
}).then(({ list }) => {
this.industryList = list
}).catch(res => {})
},
//
toPage(path) {
this.$util.to(path)
},
//
submit() {
const refs = this.$refs
const { form } = this
const { schoolId, industryClassId, industryId, name, account } = form
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('请输入账号!')
if (this.customerId) {
updateCustomer(form).then(res => {
this.$util.sucMsg('编辑成功')
setTimeout(() => {
this.$util.to('../clients/clients')
}, 1500)
}).catch(res => {})
} else {
addCustomer(form).then(res => {
this.$util.sucMsg('添加成功')
setTimeout(() => {
uni.navigateBack()
}, 1500)
}).catch(res => {})
}
},
}
}
</script>
<style scoped lang="scss">
.page {
padding-bottom: 150rpx;
}
.info {
.name {
margin-bottom: 5px;
font-size: 16px;
color: #333;
}
}
.action {
z-index: 2;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
width: 100%;
padding: 5px 10px;
background-color: #fff;
border-top: 1px solid #f3f3f3;
box-sizing: border-box;
.item {
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>

@ -1,5 +1,5 @@
<template>
<view>
<view class="page">
<view class="block">
<view class="l-title">基本信息</view>
<view class="form-list">
@ -54,32 +54,32 @@
<view class="block pro-wrap">
<view class="l-title">实训课程产品</view>
<uni-icons class="arrow" type="top" size="30" color="#007EFF"></uni-icons>
<uni-icons class="arrow" type="top" size="20" color="#007EFF"></uni-icons>
<ul class="pro-list">
<li>
<li v-for="(item, i) in courses">
<view class="name">
<view class="left">
<image class="icon" src="../../static/image/person3.png" mode=""></image>
Python程序设计
<image class="icon" src="../../static/image/course1.png" mode=""></image>
{{ item.productName }}
</view>
<uni-icons class="del" type="trash" size="25" color="#ADADAD"></uni-icons>
<uni-icons class="del" type="trash" size="25" color="#ADADAD" @click="delCourse(i)"></uni-icons>
</view>
<view class="info">
<view class="line">
<view class="label">使用期限</view>
<view class="val">202323-34123</view>
<view class="val">{{ item.startTime + ' - ' + item.endTime }}</view>
</view>
<view class="line">
<view class="label">市场价</view>
<view class="val">20232</view>
<view class="val">{{ item.marketValue }}</view>
</view>
<view class="line">
<view class="label">结算价</view>
<view class="val">2023</view>
<view class="val">{{ item.settlementPrice }}</view>
</view>
<view class="line">
<view class="label">折扣率</view>
<view class="val">23</view>
<view class="val">{{ item.discountRate }}</view>
</view>
<view class="line">
<view class="label">平台服务费</view>
@ -87,36 +87,38 @@
</view>
<view class="line done">
<view class="val">成交价格</view>
<view class="price">2123</view>
<view class="price">{{ item.finalPrice }}</view>
</view>
</view>
</li>
</ul>
</view>
<view class="add-btn">
<uni-icons class="icon" type="plus" color="#007FFF"></uni-icons>
添加产品
</view>
<view class="product">
<view class="text">
<view class="total">
已选
<text class="num">10</text>
个产品&emsp;
总成交价合计
<text class="num">2125523</text>
</view>
<view class="info">
总采购成本:
<text class="num num1">341232</text>
总产品利润:
<text class="num">564123</text>
<view class="bottom">
<view class="add-btn" @click="toAdd">
<uni-icons class="icon" type="plus" color="#007FFF"></uni-icons>
添加产品
</view>
<view class="product">
<view class="text">
<view class="total">
已选
<text class="num">10</text>
个产品&emsp;
总成交价合计
<text class="num">2125523</text>
</view>
<view class="info">
总采购成本:
<text class="num num1">341232</text>
总产品利润:
<text class="num">564123</text>
</view>
</view>
<view class="btn">提交</view>
</view>
<view class="btn">提交</view>
</view>
<view class="popup-mask" v-show="customerVisible" @click="closeCustomer"></view>
@ -159,8 +161,7 @@
customerName: '',
businessManager: ''
},
coursePermissions: [],//
dataPlatformPermissions: [],//
courses: [], //
customerVisible: false,
keyword: '',
@ -169,19 +170,25 @@
customerListAll: [],
}
},
onLoad(option) {
this.orderId = option.orderId
this.isDetail = !!option.show
option.orderId && this.getInfo()
onShow() {
const pages = getCurrentPages()
this.orderId = pages[pages.length - 1].options.orderId
this.isDetail = !!pages[pages.length - 1].options.show
const store = uni.getStorageSync('courses')
if (this.orderId) {
this.getInfo()
} else if (store) {
this.courses = store
uni.removeStorageSync('courses')
}
//
if (!this.isDetail) {
this.getCustomer()
}
//
uni.setNavigationBarTitle({
title: option.orderId ?
(option.show ?
title: this.orderId ?
(this.isDetail ?
'订单详情' :
'编辑订单') :
'新增订单'
@ -239,8 +246,27 @@
this.closeCustomer()
},
//
toPage(path) {
this.$util.to(path)
toAdd() {
this.$util.to(`../addCourse/addCourse?orderType=${this.form.orderType}`)
},
//
delCourse(i) {
const that = this
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success(res) {
res.confirm && that.courses.splice(i, 1)
}
})
},
//
calcTotal(row) {
this.dealSettlePrice(row)
let total = 0
const list = [...this.coursePermissions, ...this.dataPlatformPermissions]
list.map(e => total += +e.finalPrice)
this.form.orderAmount = total * 10000
},
//
submit() {
@ -278,6 +304,10 @@
</script>
<style scoped lang="scss">
.page {
height: calc(100vh - 300rpx);
overflow: auto;
}
.pro-wrap {
position: relative;
padding: 0;
@ -340,6 +370,10 @@
color: #007EFF;
}
}
.bottom {
position: fixed;
bottom: 0;
}
/deep/.add-btn {
display: flex;
justify-content: center;

@ -13,31 +13,35 @@
</view>
<uni-card :is-shadow="false" :border="false" is-full>
<ul class="list">
<li @click="toDetail({})">
<view class="num">1652163515968</view>
<view class="info">
<view class="left">
<view class="text">客户名称海文</view>
<view class="text">订单金额海文</view>
<view class="text">订单内容海文</view>
<view class="text">下单日期海文</view>
<view class="list-wrap">
<ul class="list">
<li @click="toDetail({})">
<view class="num">1652163515968</view>
<view class="info">
<view class="left">
<view class="text">客户名称海文</view>
<view class="text">订单金额海文</view>
<view class="text">订单内容海文</view>
<view class="text">下单日期海文</view>
</view>
<view class="type">
待审核发货
</view>
</view>
<view class="type">
待审核发货
</view>
</view>
</li>
</ul>
</li>
</ul>
<!-- <empty></empty> -->
</view>
</uni-card>
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../addOrder/addOrder')"></uni-icons>
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../orderDetail/orderDetail')"></uni-icons>
</view>
</template>
<script>
import { queryCustomer } from '@/apis/modules/client.js'
import slFilter from '@/components/sl-filter/sl-filter.vue'
import empty from '@/components/empty/empty.vue'
export default {
data() {
return {
@ -99,7 +103,8 @@
}
},
components: {
slFilter
slFilter,
empty
},
watch: {
keyword (newName, oldName) {
@ -162,7 +167,7 @@
},
//
toDetail(item) {
this.$util.to(`../orderDetail/orderDetail?customerId=${item.customerId}&show=1`)
this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`)
}
}
}
@ -172,6 +177,9 @@
.filter {
margin-bottom: 10px;
}
.list-wrap {
min-height: calc(100vh - 400rpx);
}
.list {
.num {
font-size: 16px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@ -58,6 +58,14 @@ page {
vertical-align: middle;
}
}
.inline {
display: inline-flex;
align-items: center;
@extend input;
input {
margin-right: 10rpx;
}
}
}
.picker-input .input-value-border {
line-height: 1;
@ -124,4 +132,26 @@ page {
font-size: 12px;
}
}
}
.btn-wrap {
z-index: 2;
position: fixed;
bottom: 0;
display: flex;
justify-content: flex-end;
align-items: center;
width: 100%;
padding: 20rpx 24rpx 20rpx 40rpx;
background-color: #fff;
box-shadow: 0px 0px 7rpx 0px rgba(203, 203, 203, 0.55);
box-sizing: border-box;
.btn {
width: 100%;
line-height: 80rpx;
font-size: 30rpx;
text-align: center;
color: #fff;
border-radius: 10rpx;
background-color: #007EFF;
}
}
Loading…
Cancel
Save