From bd816089005986f50f23a6e27aedec1ad5b68832 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Thu, 26 May 2022 14:46:11 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apis/modules/course.js | 6 +
apis/request.js | 2 +-
components/empty/empty.vue | 34 ++
libs/util.js | 26 ++
pages.json | 73 ++--
pages/addCourse/addCourse.vue | 201 +++++++++
pages/addOrder/addOrder.vue | 182 --------
pages/clientDetail/clientDetail.vue | 633 ++++++++++++++--------------
pages/editCourse/editCourse.vue | 265 ++++++++++++
pages/orderDetail/orderDetail.vue | 120 ++++--
pages/orders/orders.vue | 44 +-
static/image/none.png | Bin 0 -> 27957 bytes
styles/common.scss | 30 ++
13 files changed, 1020 insertions(+), 596 deletions(-)
create mode 100644 apis/modules/course.js
create mode 100644 components/empty/empty.vue
create mode 100644 pages/addCourse/addCourse.vue
delete mode 100644 pages/addOrder/addOrder.vue
create mode 100644 pages/editCourse/editCourse.vue
create mode 100644 static/image/none.png
diff --git a/apis/modules/course.js b/apis/modules/course.js
new file mode 100644
index 0000000..db4097b
--- /dev/null
+++ b/apis/modules/course.js
@@ -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)
+}
\ No newline at end of file
diff --git a/apis/request.js b/apis/request.js
index 76f3ca5..40ecc86 100644
--- a/apis/request.js
+++ b/apis/request.js
@@ -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({
diff --git a/components/empty/empty.vue b/components/empty/empty.vue
new file mode 100644
index 0000000..cf72351
--- /dev/null
+++ b/components/empty/empty.vue
@@ -0,0 +1,34 @@
+
+
+
+ 暂无数据
+
+
+
+
+
+
diff --git a/libs/util.js b/libs/util.js
index 8b57ff4..8133052 100644
--- a/libs/util.js
+++ b/libs/util.js
@@ -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
}
}
\ No newline at end of file
diff --git a/pages.json b/pages.json
index cfbf9ce..779b300 100644
--- a/pages.json
+++ b/pages.json
@@ -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 的索引项)
diff --git a/pages/addCourse/addCourse.vue b/pages/addCourse/addCourse.vue
new file mode 100644
index 0000000..95d2966
--- /dev/null
+++ b/pages/addCourse/addCourse.vue
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+ -
+
+
+ {{ item.curriculumName }}
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+
diff --git a/pages/addOrder/addOrder.vue b/pages/addOrder/addOrder.vue
deleted file mode 100644
index 4d5a8f5..0000000
--- a/pages/addOrder/addOrder.vue
+++ /dev/null
@@ -1,182 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 已选()个产品
- 总成交价合计:20000(元)
-
-
- 总采购成本:
- 总产品利润:
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/clientDetail/clientDetail.vue b/pages/clientDetail/clientDetail.vue
index c316b96..9dd3cd2 100644
--- a/pages/clientDetail/clientDetail.vue
+++ b/pages/clientDetail/clientDetail.vue
@@ -1,322 +1,317 @@
-
-
-
-
- {{ form.customerName }}
- 客户类型:{{ customerType }}
- 产品到期时间:{{ form.expireDate || '' }}
-
-
-
-
- 基本信息
-
-
- 客户名称
- {{ form.customerName }}
- {{ form.customerName || '请选择学校' }}
-
-
- 省份
- {{ form.provinceName }}
-
-
- 城市
- {{ form.cityName }}
-
-
- 行业类型
- {{ form.industryClassName }}
-
-
-
- 行业
- {{ form.industryName }}
-
-
-
- 联系人姓名
- {{ form.name }}
-
-
-
- 手机
- {{ form.phone }}
-
-
-
- 账号
- {{ form.account }}
-
-
-
- 职务
- {{ form.position }}
-
-
-
- 邮箱
- {{ form.email }}
-
-
-
- 产品到期时间
- {{ form.expireDate }}
-
-
- 客户类型
- {{ customerType }}
-
-
-
-
-
-
-
- 编辑
-
-
-
- 已订阅产品
-
-
-
- 订单
-
-
-
-
-
-
-
-
-
-
-
+ }
+ },
+ 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 => {})
+ }
+ },
+ }
+ }
+
+
+
diff --git a/pages/editCourse/editCourse.vue b/pages/editCourse/editCourse.vue
new file mode 100644
index 0000000..986197a
--- /dev/null
+++ b/pages/editCourse/editCourse.vue
@@ -0,0 +1,265 @@
+
+
+
+ 基本信息
+
+
+
+
+
+ {{ item.productName }}
+
+
+
+
+
+ 产品类型
+ {{ item.provinceName }}
+
+
+ 使用期限
+
+
+
+ 使用期限单位
+
+
+
+ 起止日期
+
+
+ {{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
+
+
+
+
+ 数量
+ 1
+
+
+
+ {{ item.authority ? '市场价' : '市场单价' }}
+ {{ item.marketValue }}元
+
+
+ 结算价
+ {{ item.settlementPrice }}元
+
+
+ 折扣率
+ {{ item.discountRate }}
+
+
+ 平台服务费
+ 元
+
+
+ 成交价
+
+
+ 元
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+
diff --git a/pages/orderDetail/orderDetail.vue b/pages/orderDetail/orderDetail.vue
index fd3faef..fd03c96 100644
--- a/pages/orderDetail/orderDetail.vue
+++ b/pages/orderDetail/orderDetail.vue
@@ -1,5 +1,5 @@
-
+
基本信息
@@ -54,32 +54,32 @@
实训课程产品
-
+
- -
+
-
-
- Python程序设计
+
+ {{ item.productName }}
-
+
使用期限
- 202323-34123
+ {{ item.startTime + ' - ' + item.endTime }}
市场价(元)
- 20232元
+ {{ item.marketValue }}元
结算价
- 2023元
+ {{ item.settlementPrice }}元
折扣率
- 23
+ {{ item.discountRate }}
平台服务费
@@ -87,36 +87,38 @@
成交价格
- 2123元
+ {{ item.finalPrice }}元
-
-
- 添加产品
-
-
-
-
-
- 已选
- 10
- 个产品
- 总成交价合计
- 2125523
- 元
-
-
- 总采购成本:
- 341232
- 总产品利润:
- 564123
+
+
+
+ 添加产品
+
+
+
+
+
+ 已选
+ 10
+ 个产品
+ 总成交价合计
+ 2125523
+ 元
+
+
+ 总采购成本:
+ 341232
+ 总产品利润:
+ 564123
+
+ 提交
- 提交
@@ -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 @@