From 7bd7775908aa73d9980eef10629e4185c9ac3a98 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Wed, 22 Jun 2022 10:54:16 +0800
Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 31 ++++
apis/modules/order.js | 4 +
apis/request.js | 14 +-
libs/util.js | 10 +-
order/addCourse/addCourse.vue | 56 ++++---
order/curClient/curClient.vue | 243 ++++++++++++++++++++++++++++
order/editCourse/editCourse.vue | 44 +++--
order/orderDetail/orderDetail.vue | 156 +++++++++++-------
order/ordered/ordered.vue | 1 -
order/orders/orders.vue | 10 +-
pages.json | 12 +-
pages/account/account.vue | 4 +-
pages/clientDetail/clientDetail.vue | 9 +-
pages/clients/clients.vue | 2 +-
pages/email/email.vue | 4 +-
pages/index/index.vue | 3 +-
pages/person/person.vue | 1 -
pages/phone/phone.vue | 8 +-
pages/plans/plans.vue | 2 +-
pages/products/products.vue | 2 +-
pages/setting/setting.vue | 20 ++-
static/image/trash.png | Bin 0 -> 416 bytes
styles/common.scss | 2 +-
23 files changed, 509 insertions(+), 129 deletions(-)
create mode 100644 order/curClient/curClient.vue
create mode 100644 static/image/trash.png
diff --git a/App.vue b/App.vue
index d996bf2..71b9db2 100644
--- a/App.vue
+++ b/App.vue
@@ -4,7 +4,38 @@
},
onShow: function() {
+ console.log('App Launch');
+ const updateManager = uni.getUpdateManager();
+ // 检查小程序是否有新版本发布
+ updateManager.onCheckForUpdate(function (res) {
+ // 请求完新版本信息的回调
+ console.log('onCheckForUpdate', res.hasUpdate);
+ });
+ // 小程序有新版本,则静默下载新版本,做好更新准备
+ updateManager.onUpdateReady(function (res) {
+ console.log('onUpdateReady', res);
+ uni.showModal({
+ title: '更新提示',
+ content: '新版本已经准备好,点击确定重新启动',
+ showCancel:false,
+ success(res) {
+ if (res.confirm) {
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+ updateManager.applyUpdate();
+ }
+ }
+ });
+ });
+
+ updateManager.onUpdateFailed(function (res) {
+ console.log('onUpdateFailed', res);
+ // 新的版本下载失败
+ uni.showModal({
+ title: '已经有新版本了哟~',
+ content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
+ });
+ })
}
}
diff --git a/apis/modules/order.js b/apis/modules/order.js
index 053256b..345afca 100644
--- a/apis/modules/order.js
+++ b/apis/modules/order.js
@@ -25,6 +25,10 @@ export const list = (data) => {
return post('nakadai/applets/order/orderList', data)
}
+export const orderList = (data) => {
+ return post('nakadai/nakadai/order/list', data)
+}
+
export const del = (data) => {
return post('nakadai/nakadai/order/delete', data)
}
\ No newline at end of file
diff --git a/apis/request.js b/apis/request.js
index 9f0f320..b42f7bb 100644
--- a/apis/request.js
+++ b/apis/request.js
@@ -5,11 +5,11 @@ const request = options => {
HTTP_COUNT++
if (config.showLoading) {
// 请求数据时的loading
- uni.showToast({
- title: '加载中',
- duration: 200,
- icon: 'loading'
- })
+ // uni.showToast({
+ // title: '加载中',
+ // duration: 200,
+ // icon: 'loading'
+ // })
}
const header = Object.assign({}, config.headers, {
token: uni.getStorageSync('token')
@@ -59,8 +59,8 @@ const request = options => {
},
complete: () => {
if (config.showLoading) {
- HTTP_COUNT--
- HTTP_COUNT || uni.hideLoading()
+ // HTTP_COUNT--
+ // HTTP_COUNT || uni.hideLoading()
}
}
})
diff --git a/libs/util.js b/libs/util.js
index b6f73c3..2fdba01 100644
--- a/libs/util.js
+++ b/libs/util.js
@@ -13,16 +13,18 @@ export default {
})
},
// 成功提示
- sucMsg(title) {
+ sucMsg(title, duration = 1500) {
uni.showToast({
- title
+ title,
+ duration
})
},
// 错误提示
- errMsg(title) {
+ errMsg(title, duration = 1500) {
uni.showToast({
title,
- icon: 'none'
+ icon: 'none',
+ duration
})
},
// 如果非数字,则返回0
diff --git a/order/addCourse/addCourse.vue b/order/addCourse/addCourse.vue
index 3fcc905..6e94c0f 100644
--- a/order/addCourse/addCourse.vue
+++ b/order/addCourse/addCourse.vue
@@ -9,8 +9,8 @@
- -
-
+
-
+ checkChange(e, i)">
{{ item.productName }}
@@ -18,8 +18,8 @@
-
- 确定
+
+ 确定({{ checked.length }})
@@ -70,6 +70,7 @@
text: '全部',
value: 1
}],
+ checked: uni.getStorageSync('courses') || [], // 已经勾选的集合
courses: uni.getStorageSync('courses') || []
}
},
@@ -77,7 +78,7 @@
keyword () {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
- this.getList()
+ this.initList()
}, 500)
}
},
@@ -108,30 +109,34 @@
getList() {
AppletsDataProductList({
sort: '',
- keywords: '',
+ keywords: this.keyword,
productType: this.curTab,
pageNum: this.page,
pageSize: this.pageSize
}).then(({ data }) => {
const { records } = data
const list = this.courses
+ const all = this.checkAll.length // 是否勾选了全选
+ const pageChange = this.reachBottom > 0 // 是否是翻页
+ const { checked } = this // 已选数据
// 添加选择框字段
records.map(e => {
const checkData = {
text: '',
value: 1
}
- e.check = []
+ e.check = (all && pageChange) || checked.find(n => n.id === e.id && n.productType === e.productType) ? [1] : []
// 筛选已经勾选的产品
- if (list.find(n => n.dataOrCourseId == e.id)) {
- checkData.disable = true // 已经选择了的则禁止选择
+ if (list.find(n => n.dataOrCourseId == e.id && n.productType == e.productType)) {
+ // 已经选择了的则禁止选择,并且直接选中
+ checkData.disable = true
e.check = [1]
}
e.checkData = [checkData]
})
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
- this.list = this.reachBottom > 0 ? [...this.list, ...records] : records
+ this.list = pageChange ? [...this.list, ...records] : records
this.page++ // 每次获取了数据后page+1
const noMore = this.list.length === data.total // 是否加载完所有数据
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
@@ -148,14 +153,29 @@
this.curTab = tab.id
this.initList()
},
+ // 选择框回调
+ checkChange(e, i) {
+ const { checked } = this
+ const item = this.list[i]
+ const { id, productType } = item
+ const include = checked.findIndex(e => e.id === id && e.productType === productType)
+ // 选中的情况下,该产品如果没有push到已选数组里,则push
+ if (e.detail.value.length) {
+ include === -1 && checked.push(item)
+ } else {
+ // 取消选中的情况下,如果已选数组里存在该产品,则移除
+ include === -1 || checked.splice(include, 1)
+ }
+ },
// 全选
- checkChange(e) {
+ allChange(e) {
const checked = !!e.detail.value.length
- this.list.map(e => e.check = [checked ? 1 : '']) // 选中则为[1],取消选中为[]
+ this.list.map(e => e.check = checked ? [1] : []) // 选中则为[1],取消选中为[]
},
// 生成产品参数
createParam(e) {
const { orderType } = this
+ const trial = orderType == 2 // 是否是试用
return {
dataOrCourseId: e.id, // id
productName: e.productName, // 名称
@@ -165,17 +185,17 @@
remainingPeriod: '', // 剩余期限
marketValue: '', // 市场价
marketPrice: e.marketPrice, // 市场单价
- finalPrice: orderType == 2 ? 0 : '', // 成交价
- discountRate: '', // 折扣率
+ finalPrice: trial ? 0 : '', // 成交价
+ discountRate: trial ? '0%' : '', // 折扣率
accountNum: e.productType === 2 ? '' : 1, // 账号数
totalAmount: '', // 总价
isEnable: 1, // 启用否:1启用,0禁用
ship: 0, // 发货否(0未发货,1已发货,默认不发货)
authority: e.productType === 2 ? 0 : 1, // 区分权限 0为数据平台权限,1为课程权限
productType: e.productType, // 课程分类 (0->理论 1-实训 2 数据产品)
- options: 1,
+ options: 2,
miniProgramPictureAddress: e.miniProgramPictureAddress, // 图标
- settlementPrice: orderType == 2 ? 0 : '', // 结算价
+ settlementPrice: trial ? 0 : '', // 结算价
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成
settlementPriceUnit: e.settlementPrice, // 结算单价
businessProportion: e.businessProportion, // 商务占比
@@ -204,7 +224,7 @@
},
// 确定
submit() {
- const list = this.list.filter(e => e.check.length) // 筛选出选中了的产品
+ const list = this.checked // 已选产品
if (list.length) {
const result = this.courses
const courseIds = []
@@ -212,7 +232,7 @@
const { customerId } = this
list.map(e => {
// 新勾选的产品,则获取到id,下面要调用,
- if (!result.find(n => n.dataOrCourseId == e.id && n.authority == e.authority)) {
+ if (!result.find(n => (n.dataOrCourseId == e.id || n.dataOrCourseId == e.dataOrCourseId) && ((n.authority && e.productType != 2) || (!n.authority && e.productType == 2)))) {
e.productType === 2 ? dataIds.push(e.id) : courseIds.push(e.id)
result.push(this.createParam(e))
}
diff --git a/order/curClient/curClient.vue b/order/curClient/curClient.vue
new file mode 100644
index 0000000..e839bbc
--- /dev/null
+++ b/order/curClient/curClient.vue
@@ -0,0 +1,243 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.orderNumber }}
+
+
+
+ 商务经理:
+ {{ item.businessManagerName }}
+
+
+ 订单名称:
+ {{ item.customerName }}
+
+
+ 订单金额:
+ {{ item.orderAmount }}
+
+
+ 订单内容:
+
+ {{ item.orderContent }}
+ {{ item.toggle ? '收起' : '展开' }}
+
+
+
+ 下单日期:
+ {{ item.createTime }}
+
+
+
+ {{ filterData[0].data.find(e => e.value === item.orderStatus).title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/order/editCourse/editCourse.vue b/order/editCourse/editCourse.vue
index a7d5cd7..21e0e3a 100644
--- a/order/editCourse/editCourse.vue
+++ b/order/editCourse/editCourse.vue
@@ -16,15 +16,15 @@
产品类型
- {{ item.provinceName }}
+ {{ productTypes.find(e => e.id === item.productType).name }}
使用期限
-
+
使用期限单位
-
+
起止日期
@@ -37,7 +37,7 @@
数量
1
-
+
{{ item.authority ? '市场价' : '市场单价' }}
@@ -58,7 +58,7 @@
成交价
-
+
元
@@ -89,6 +89,20 @@
text: '年',
value: 2
}],
+ productTypes: [
+ {
+ name: '实训课程',
+ id: 1
+ },
+ {
+ name: '理论课程',
+ id: 0
+ },
+ {
+ name: '数据产品',
+ id: 2
+ }
+ ],
courses: {} , // 上一页缓存的产品
orderRepeat: [],
repeatMsg: ''
@@ -129,8 +143,10 @@
type === 1 ?
courses.practice.list.push(e) :
courses.data.list.push(e)
+
})
this.courses = courses
+ console.log(22, this.courses, this.classes)
try {
uni.removeStorageSync('courses')
} catch (e) {}
@@ -172,16 +188,14 @@
row.remainingPeriod = endYears
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)
- }
+ // 计算市场价
+ 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 (!fromData) {
diff --git a/order/orderDetail/orderDetail.vue b/order/orderDetail/orderDetail.vue
index 01cb424..827c998 100644
--- a/order/orderDetail/orderDetail.vue
+++ b/order/orderDetail/orderDetail.vue
@@ -22,7 +22,7 @@
联系人
- {{ form.name }}
+ {{ form.orderContact }}
电话
@@ -57,13 +57,13 @@
{{ c.name }}
- -
+
-
{{ item.productName }}
-
+
@@ -97,15 +97,17 @@
-
-
- 添加产品
+
+
+
+ 添加产品
+
-
+
- 已选
+ {{ isDetail ? '共' : '已' }}选
{{ courses.length }}
个产品
总成交价合计
@@ -113,10 +115,12 @@
元
- 总采购成本:
- {{ form.purchaseCost }}元
- 总产品利润:
- {{ form.profit }} 元
+
+ 总采购成本:{{ form.purchaseCost }}元
+
+
+ 总产品利润: {{ form.profit }} 元
+
提交
@@ -165,7 +169,7 @@
orderAmount: 0,
customerName: '',
profit: 0, // 利润
- purchaseCost: '', // 采购成本
+ purchaseCost: 0, // 采购成本
teamId: uni.getStorageSync('team').teamId,
businessManagerId: this.$util.getBmId()
},
@@ -308,7 +312,7 @@
form.cityName = e.cityName
form.phone = e.phone
form.email = e.email
- form.name = e.name
+ form.orderContact = e.name
}).catch(e => {})
this.closeCustomer()
},
@@ -320,13 +324,32 @@
this.$util.to(`../addCourse/addCourse?orderType=${orderType}&customerId=${customerId}`) :
this.$util.errMsg('请先选择客户!')
},
+ // 编辑课程
+ editCourse(c, i) {
+ if (this.isDetail) return false
+ uni.setStorageSync('courses', this.courses)
+ const { customerId, orderType } = this.form
+ this.$util.to(`../editCourse/editCourse?orderType=${orderType}&customerId=${customerId}`)
+ },
// 删除课程
delCourse(c, i) {
+ const that = this
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success(res) {
- res.confirm && c.list.splice(i, 1)
+ if (res.confirm) {
+ c.list.splice(i, 1)
+ const courses = []
+ const list = that.courseList
+ for (const j in list) {
+ list[j].list.map(n => {
+ courses.push(n)
+ })
+ }
+ that.courses = courses
+ that.calcTotal()
+ }
}
})
},
@@ -337,31 +360,28 @@
// 计算订单总额
calcTotal() {
const { form } = this
- // 老数据没有这两个字段,则手动计算
- if (!form.purchaseCost && !form.profit) {
- let total = 0
- const list = this.courses
- let purchase = 0 // 总采购成本
- let profit = 0 // 总利润
- /**
- * 1)总采购成本+总产品利润=总成交价格
-
- (2)单个产品采购成本 =结算价+平台服务费
-
- (3)平台服务费=结算价*10%
-
- (4)单个产品的利润=成交价-采购成本
-
- 总成本和总利润为单个产品的采购成本价和利润的和
- */
- list.map(e => {
- const curPurchase = +e.settlementPrice + +e.serviceFee
- purchase += curPurchase
- profit += +e.finalPrice - curPurchase
- })
- form.purchaseCost = Math.round(purchase)
- form.profit = Math.round(profit)
- }
+ let total = 0
+ const list = this.courses
+ let purchase = 0 // 总采购成本
+ let profit = 0 // 总利润
+ /**
+ * 1)总采购成本+总产品利润=总成交价格
+
+ (2)单个产品采购成本 =结算价+平台服务费
+
+ (3)平台服务费=结算价*10%
+
+ (4)单个产品的利润=成交价-采购成本
+
+ 总成本和总利润为单个产品的采购成本价和利润的和
+ */
+ list.map(e => {
+ const curPurchase = +e.settlementPrice + +e.serviceFee
+ purchase += curPurchase
+ profit += +e.finalPrice - curPurchase
+ })
+ form.purchaseCost = Math.round(purchase)
+ form.profit = Math.round(profit)
form.orderAmount = +form.purchaseCost + +form.profit
},
// 提交
@@ -431,6 +451,9 @@
display: inline-flex;
align-items: center;
}
+ .del {
+ width: 40rpx;
+ }
.icon {
width: 60rpx;
height: 60rpx;
@@ -473,13 +496,17 @@
padding-bottom: env(safe-area-inset-bottom);
width: 100%;
background-color: #fff;
+ box-shadow: 0 -2px 2px #f5f5f5;
box-sizing: border-box;
}
+.add-wrap {
+ padding: 16rpx 24rpx 40rpx;
+ background-color: #f5f5f5;
+}
/deep/.add-btn {
display: flex;
justify-content: center;
align-items: center;
- margin: 16rpx 24rpx;
font-size: 28rpx;
line-height: 88rpx;
color: #007EFF;
@@ -498,33 +525,52 @@
justify-content: flex-end;
align-items: center;
padding: 24rpx;
- margin-top: 40rpx;
background-color: #fff;
.total {
- margin-bottom: 10rpx;
- font-size: 24rpx;
- color: #666;
+
+ white-space: nowrap;
+ }
+ &.show {
+ padding: 24rpx 50rpx;
+ .total {
+ margin-bottom: 30rpx;
+ font-size: 30rpx;
+ font-weight: 600;
+ color: #333;
+ .num {
+ color: #007EFF;
+ }
+ }
+ .line {
+ text-align: right;
+ &:first-child {
+ margin-bottom: 8px;
+ }
+ }
+ }
+ &.edit {
+ .total {
+ margin-bottom: 10rpx;
+ font-size: 24rpx;
+ color: #666;
+ }
.num {
margin: 0 5rpx;
font-size: 34rpx;
color: #007EFF;
}
+ .info {
+ display: flex;
+ }
}
.info {
font-size: 24rpx;
color: #333;
- .num {
- margin: 0 5rpx;
- font-size: 32rpx;
- color: #007EFF;
- }
- }
- .num1 {
- margin-right: 10rpx;
+ white-space: nowrap;
}
.btn {
- width: 196rpx;
- margin-left: 27rpx;
+ width: 180rpx;
+ margin-left: 10rpx;
line-height: 80rpx;
font-size: 32rpx;
text-align: center;
diff --git a/order/ordered/ordered.vue b/order/ordered/ordered.vue
index 9d20252..d8cf4ea 100644
--- a/order/ordered/ordered.vue
+++ b/order/ordered/ordered.vue
@@ -128,7 +128,6 @@
}, 1500)
},
onShow() {
- console.log(33, this.normalIcon, product)
const pages = getCurrentPages()
this.customerId = pages[pages.length - 1].options.customerId
this.getList()
diff --git a/order/orders/orders.vue b/order/orders/orders.vue
index 9897e0f..a09f38c 100644
--- a/order/orders/orders.vue
+++ b/order/orders/orders.vue
@@ -1,7 +1,7 @@
-
+
@@ -22,6 +22,10 @@
{{ item.orderNumber }}
+
+ 商务经理:
+ {{ item.businessManagerName }}
+
订单名称:
{{ item.customerName }}
@@ -34,7 +38,7 @@
订单内容:
{{ item.orderContent }}
- 展开
+ {{ item.toggle ? '收起' : '展开' }}
@@ -170,7 +174,7 @@
getList() {
const data = {
businessManagerId: this.$util.getBmId(),
- teamId: uni.getStorageSync('team').teamId,
+ teamId: uni.getStorageSync('team').partnerClassificationId,
keywords: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
diff --git a/pages.json b/pages.json
index e7fb31d..616762e 100644
--- a/pages.json
+++ b/pages.json
@@ -171,8 +171,16 @@
"navigationBarTitleText": "编辑产品",
"enablePullDownRefresh": false
}
- }
- ]
+ },
+ {
+ "path" : "curClient/curClient",
+ "style" :
+ {
+ "navigationBarTitleText": "订单记录",
+ "enablePullDownRefresh": false
+ }
+ }
+ ]
}],
"preloadRule": {
"order/orders/orders": {
diff --git a/pages/account/account.vue b/pages/account/account.vue
index 286ccc1..991902e 100644
--- a/pages/account/account.vue
+++ b/pages/account/account.vue
@@ -39,9 +39,7 @@
changeAccount(account).then(res => {
this.$util.sucMsg('修改成功!')
setTimeout(() => {
- uni.reLaunch({
- url: '../person/person'
- })
+ uni.navigateBack()
}, 1000)
}).catch(e => {})
}
diff --git a/pages/clientDetail/clientDetail.vue b/pages/clientDetail/clientDetail.vue
index dd95955..5f5cf07 100644
--- a/pages/clientDetail/clientDetail.vue
+++ b/pages/clientDetail/clientDetail.vue
@@ -42,7 +42,7 @@
手机
{{ form.phone }}
-
+
账号
@@ -79,7 +79,7 @@
已订阅产品
-
+
订单
@@ -269,7 +269,7 @@
}).catch(res => {})
} else {
addCustomer(form).then(res => {
- this.$util.sucMsg('创建客户成功!你现在可以去订单给客户下单了。')
+ this.$util.errMsg('创建客户成功!你现在可以去订单给客户下单了。')
setTimeout(() => {
uni.navigateBack()
}, 1500)
@@ -283,8 +283,6 @@