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 @@ + + + + + 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 @@ - - - - - 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 @@ - - - - - + } + }, + 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 @@ + + + + + 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 @@