@ -1,399 +0,0 @@ |
||||
<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-wrap"> |
||||
<view class="tab"> |
||||
<li :class="{active: curTab === ''}" @click="tabChange('')">全部</li> |
||||
</view> |
||||
|
||||
<scroll-view scroll-x :scroll-left="scrollLeft" class="tab tab-scroll"> |
||||
<li v-for="(tab, i) in tabs" :key="i" :class="{active: curTab === tab.id}" @click="tabChange(tab.id)">{{ tab.name }}</li> |
||||
</scroll-view> |
||||
</ul> |
||||
|
||||
<ul class="list"> |
||||
<li v-for="(item, i) in list" :key="i"> |
||||
<uni-data-checkbox v-if="item.check" class="check" multiple :value="[1]" :localdata="item.checkData" @change="e => checkChange(e, i)"></uni-data-checkbox> |
||||
<uni-data-checkbox v-else class="check" multiple v-model="item.check" :localdata="item.checkData" @change="e => checkChange(e, i)"></uni-data-checkbox> |
||||
<image class="icon" :src="$util.getIcon(item)"></image> |
||||
{{ item.productName }} |
||||
</li> |
||||
</ul> |
||||
<uni-load-more :status="status" /> |
||||
|
||||
<view class="btn-wrap"> |
||||
<uni-data-checkbox class="check" multiple v-model="checkAll" :localdata="checkAllData" @change="allChange"></uni-data-checkbox> |
||||
<view class="btn" @click="submit">确定({{ checked.length }})</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { productTypeList, listOfGoods } from '@/apis/modules/product.js' |
||||
import { renew, queryCitySettlementPrice } from '@/apis/modules/order.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
// authority: 权限。0数据平台,1为课程,2职站增值模块,3实训课程(非集成),4实验工具 |
||||
orderType: 1, |
||||
customerId: '', |
||||
provinceId: '', |
||||
cityId: '', |
||||
curTab: '', |
||||
tabs: [], |
||||
scrollLeft: 0, |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
orderStatus: '', |
||||
productStatus: '', |
||||
keyword: '', |
||||
list: [], |
||||
listAll: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
check: [1], |
||||
noCheck: [], |
||||
checkData: [{ |
||||
text: '', |
||||
value: 1 |
||||
}], |
||||
checkAll: [], |
||||
checkAllData: [{ |
||||
text: '全部', |
||||
value: 1 |
||||
}], |
||||
checked: uni.getStorageSync('courses') || [], // 已经勾选的集合 |
||||
courses: uni.getStorageSync('courses') || [], |
||||
submiting: false, |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
const { options } = pages[pages.length - 1] |
||||
this.orderType = options.orderType |
||||
this.customerId = options.customerId |
||||
this.provinceId = options.provinceId |
||||
this.cityId = options.cityId |
||||
this.getTypes() |
||||
this.getList() |
||||
}, |
||||
methods: { |
||||
// 产品类型 |
||||
getTypes() { |
||||
productTypeList().then(res => { |
||||
res.typeList.forEach(e => { |
||||
e.id = e.typeId |
||||
e.name = e.typeName |
||||
}) |
||||
this.tabs.push(...res.typeList) |
||||
}).catch(e => {}) |
||||
}, |
||||
// 获取课程列表 |
||||
getList() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
listOfGoods({ |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
sort: 0, |
||||
isShelves: 0, |
||||
hotTag: 1, |
||||
productName: this.keyword, |
||||
productType: this.curTab, |
||||
}).then(({ page }) => { |
||||
const { records } = page |
||||
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 = (all && pageChange) || checked.find(n => n.mallId === e.mallId) ? 1 : 0 |
||||
// 筛选已经勾选的产品 |
||||
if (list.find(n => n.mallId == e.mallId)) { |
||||
// 已经选择了的则禁止选择,并且直接选中 |
||||
checkData.disable = true |
||||
e.check = 1 |
||||
} |
||||
e.checkData = [checkData] |
||||
}) |
||||
|
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
this.list = pageChange ? [...this.list, ...records] : records |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === page.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
uni.hideLoading() |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// tab切换 |
||||
tabChange(id) { |
||||
this.curTab = id |
||||
this.initList() |
||||
}, |
||||
// 选择框回调 |
||||
checkChange(e, i) { |
||||
const { checked } = this |
||||
const item = this.list[i] |
||||
const { mallId } = item |
||||
const include = checked.findIndex(e => e.mallId === mallId) |
||||
// 选中的情况下,该产品如果没有push到已选数组里,则push |
||||
if (e.detail.value.length) { |
||||
include === -1 && checked.push(item) |
||||
} else { |
||||
// 取消选中的情况下,如果已选数组里存在该产品,则移除 |
||||
if (include !== -1) { |
||||
checked.splice(include, 1) |
||||
this.checkAll = [] |
||||
} |
||||
} |
||||
}, |
||||
// 全选 |
||||
allChange(e) { |
||||
const isCheck = !!e.detail.value.length // 是否选中 |
||||
const { checked, list } = this |
||||
list.map(e => { |
||||
e.check = isCheck ? 1 : 0 |
||||
const { mallId } = e |
||||
const include = checked.findIndex(n => n.mallId === mallId) |
||||
// 选中的情况下,该产品如果没有push到已选数组里,则push |
||||
if (isCheck) { |
||||
include === -1 && checked.push(e) |
||||
} else { |
||||
// 取消选中的情况下,如果已选数组里存在该产品,则移除 |
||||
include === -1 || checked.splice(include, 1) |
||||
} |
||||
}) |
||||
}, |
||||
// 生成产品参数 |
||||
createParam(e, authority) { |
||||
const { orderType } = this |
||||
const trial = orderType == 2 // 是否是试用 |
||||
return { |
||||
dataOrCourseId: e.associatedProduct, // id |
||||
mallId: e.mallId, |
||||
productName: e.productName, // 名称 |
||||
periodOfUse: trial ? 1 : '', // 使用期限 |
||||
startTime: this.$util.formatDate(new Date(), 'yyyy-MM-dd'), // 开始 |
||||
endTime: '', // 终止 |
||||
remainingPeriod: '', // 剩余期限 |
||||
marketValue: '', // 市场价 |
||||
marketPrice: e.marketUnitPrice, // 市场单价 |
||||
finalPrice: trial ? 0 : '', // 成交价 |
||||
finalValue: trial ? 0 : '', // 成交单价(数据产品特有) |
||||
discountRate: trial ? '0%' : '', // 折扣率 |
||||
accountNum: authority ? 1 : '', // 账号数 |
||||
totalAmount: '', // 总价 |
||||
isEnable: 0, // 启用否:1启用,0禁用 |
||||
ship: 0, // 发货否(0未发货,1已发货,默认不发货) |
||||
authority, // 区分权限 0为数据平台权限,1为课程权限 |
||||
options: trial ? 1 : 2, |
||||
miniProgramPictureAddress: e.appletIcon || '', // 图标 |
||||
settlementPrice: trial ? 0 : '', // 结算价 |
||||
settlementPriceUnit: e.settlementPrice || 0, // 结算单价 |
||||
serviceFee: 0, // 平台服务费(前端计算后展示,不入库) |
||||
mallNonAssociatedLinks: e.mallNonAssociatedLinks, // 产品链接 |
||||
typeId: e.typeId, |
||||
typeName: e.typeName, |
||||
classificationId: e.classificationId, |
||||
} |
||||
}, |
||||
// 判断是否为客户已有的课程 |
||||
handleRenew(authority, customerId, productId, result, resolve, reject) { |
||||
renew({ |
||||
authority, |
||||
customerId, |
||||
productId |
||||
}).then(({ orderOthers }) => { |
||||
result.map(e => { |
||||
const item = orderOthers.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority) |
||||
if (item) { |
||||
let date = new Date(item.endTime) |
||||
date = new Date(date.setDate(date.getDate() + 1)) |
||||
e.startTime = this.$util.formatDate(date, 'yyyy-MM-dd') |
||||
} |
||||
}) |
||||
resolve() |
||||
}).catch(e => { |
||||
reject() |
||||
}) |
||||
}, |
||||
// 确定 |
||||
submit() { |
||||
const list = this.checked // 已选产品 |
||||
if (list.length) { |
||||
if (this.submiting) return false |
||||
this.submiting = true |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
|
||||
const result = this.courses |
||||
const list1 = [] // 实训、理论 |
||||
const list0 = [] // 数据前瞻 |
||||
const list2 = [] // 职站增值 |
||||
const list3 = [] // 实训课程(非集成) |
||||
const list4 = [] // 实验工具 |
||||
const { customerId } = this |
||||
|
||||
const listPromise = [] |
||||
list.forEach(async e => { |
||||
listPromise.push(new Promise(async (resolve, reject) => { |
||||
// 新勾选的产品,则获取到id,下面要调用 |
||||
if (!result.find(n => (n.dataOrCourseId == e.associatedProduct || n.dataOrCourseId == e.dataOrCourseId) && n.authority == e.authority)) { |
||||
// 查询产品管理设置的平台结算价 |
||||
if (this.provinceId) { |
||||
const res = await queryCitySettlementPrice(e.mallId, this.provinceId, this.cityId) |
||||
if (res.mallPrice) e.settlementPrice = res.mallPrice.discountRate |
||||
} |
||||
const classId = e.classificationId |
||||
const pid = +e.associatedProduct |
||||
const { mallId } = e |
||||
if (classId == 1 || classId == 2) { |
||||
list1.push(mallId) |
||||
} else if (classId == 3) { |
||||
list2.push(mallId) |
||||
} else if (classId == 4) { |
||||
list3.push(mallId) |
||||
} else if (classId == 5) { |
||||
list0.push(mallId) |
||||
} else if (classId == 6) { |
||||
list4.push(mallId) |
||||
} |
||||
result.push(this.createParam(e, this.$util.getOrderType(classId))) |
||||
resolve() |
||||
} else { |
||||
resolve() |
||||
} |
||||
})) |
||||
}) |
||||
Promise.all(listPromise).then(_ => { |
||||
const promises = [] |
||||
// 有5种产品,要传不同的authority调renew接口 |
||||
list0.length && promises.push(new Promise((resolve, reject) => { |
||||
this.handleRenew(0, customerId, list0, result, resolve, reject) |
||||
})) |
||||
list1.length && promises.push(new Promise((resolve, reject) => { |
||||
this.handleRenew(1, customerId, list1, result, resolve, reject) |
||||
})) |
||||
list2.length && promises.push(new Promise((resolve, reject) => { |
||||
this.handleRenew(2, customerId, list2, result, resolve, reject) |
||||
})) |
||||
list3.length && promises.push(new Promise((resolve, reject) => { |
||||
this.handleRenew(3, customerId, list3, result, resolve, reject) |
||||
})) |
||||
list4.length && promises.push(new Promise((resolve, reject) => { |
||||
this.handleRenew(4, customerId, list4, result, resolve, reject) |
||||
})) |
||||
Promise.all(promises).then(_ => { |
||||
console.log(33, result) |
||||
uni.setStorageSync('courses', result) // 把选中的产品添加至缓存 |
||||
uni.redirectTo({ |
||||
url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}` |
||||
}) |
||||
}) |
||||
}) |
||||
} else { |
||||
this.$util.errMsg('请选择产品!') |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 130rpx; |
||||
} |
||||
.tab-wrap { |
||||
display: flex; |
||||
.tab-scroll { |
||||
width: calc(100% - 100rpx); |
||||
white-space: nowrap; |
||||
li { |
||||
display: inline-block; |
||||
} |
||||
} |
||||
} |
||||
.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; |
||||
min-width: 80rpx; |
||||
height: 80rpx; |
||||
margin: 0 20rpx; |
||||
border-radius: 4px; |
||||
} |
||||
} |
||||
/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 { |
||||
position: fixed; |
||||
justify-content: space-between; |
||||
.btn { |
||||
width: 340rpx; |
||||
margin-left: 27rpx; |
||||
} |
||||
} |
||||
</style> |
@ -1,280 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<view :class="['page', {'not-auth': !per}]"> |
||||
<view class="filter"> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入客户名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons> |
||||
</view> |
||||
<ul class="tab"> |
||||
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li> |
||||
</ul> |
||||
|
||||
<template v-if="list.length"> |
||||
<ul class="list"> |
||||
<li v-for="item in list" @click="toDetail(item)"> |
||||
<view class="c-name">{{ item.customerName }}</view> |
||||
<view class="info"> |
||||
<view class="left"> |
||||
<view class="line"> |
||||
<text class="name">联系人:</text> |
||||
<text class="val">{{ item.orderContact }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">账号:</text> |
||||
<text class="val">{{ item.account }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">产品到期时间:</text> |
||||
<text class="val">{{ item.expireDate.split(' ')[0] }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">商务经理:</text> |
||||
<text class="val">{{ item.businessManagerName }}</text> |
||||
</view> |
||||
</view> |
||||
<view class="type"> |
||||
{{ filterData[0].data.find(e => e.value === item.customerType).title }}客户 |
||||
</view> |
||||
</view> |
||||
</li> |
||||
</ul> |
||||
<uni-load-more :status="status" /> |
||||
</template> |
||||
<empty v-else text="您当前暂无有下单的客户,请快去给客户下订单吧"></empty> |
||||
|
||||
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../clientDetail/clientDetail')"></uni-icons> |
||||
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup> |
||||
</view> |
||||
|
||||
<notAuth v-if="!per"></notAuth> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { list, all } from '@/apis/modules/client.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
per: true, // 是否有权限 |
||||
popup: false, |
||||
//筛选表单数据 |
||||
filterData: [ |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "客户类型", |
||||
key: "customerType", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
isRadio: true, //是否单选 否则多选 |
||||
data: [ |
||||
{ |
||||
title: '正式', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
title: '试用', |
||||
value: 2 |
||||
}, |
||||
{ |
||||
title: '到期', |
||||
value: 3 |
||||
} |
||||
], |
||||
} |
||||
], |
||||
filterForm: { |
||||
customerType: [] |
||||
}, |
||||
curTab: 0, |
||||
tabs: [], |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
customerType: '', |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10 |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.per = true |
||||
this.initRole() |
||||
}, |
||||
methods: { |
||||
// 初始化权限 |
||||
initRole() { |
||||
this.tabs = [] |
||||
const auth = uni.getStorageSync('auth') |
||||
auth.includes('工作台:客户:我的客户') && this.tabs.push({ |
||||
name: '我的客户', |
||||
id: 0 |
||||
}) |
||||
auth.includes('工作台:客户:团队全部客户') && this.tabs.push({ |
||||
name: '团队全部客户', |
||||
id: 1 |
||||
}) |
||||
const len = this.tabs.length |
||||
if (len) { |
||||
// 只有一个的话,取第一个,而且不用显示tab |
||||
if (len === 1) { |
||||
this.curTab = this.tabs[0].id |
||||
this.tabs = [] |
||||
} |
||||
this.initList() |
||||
} else { |
||||
this.list = [ |
||||
{ |
||||
orderContact: '智信云', |
||||
account: '智信云师资培训班', |
||||
businessManagerName: 'python实训系统', |
||||
expireDate: '2023-08-08' |
||||
}, |
||||
{ |
||||
orderContact: '智信云智信云', |
||||
account: '智信云师资培训班智信云师资培训班', |
||||
businessManagerName: 'python实训系统', |
||||
expireDate: '2023-08-08' |
||||
}, |
||||
{ |
||||
orderContact: '智信云智信云', |
||||
account: '智信云师资培训班智信云师资培训班', |
||||
businessManagerName: 'python实训系统实训系统', |
||||
expireDate: '2023-08-08' |
||||
}, |
||||
{ |
||||
orderContact: '智信云智信云', |
||||
account: '智信云师资培训班智信云师资培训班', |
||||
businessManagerName: 'python实训系统', |
||||
expireDate: '2023-08-08' |
||||
}, |
||||
] |
||||
this.per = false // 没有权限 |
||||
} |
||||
}, |
||||
// 获取列表 |
||||
getList() { |
||||
const data = { |
||||
businessManagerId: this.$util.getBmId(), |
||||
teamId: uni.getStorageSync('team').id, |
||||
customerType: this.customerType, |
||||
keywords: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
type: this.curTab // 团队:1 / 个人:0 |
||||
} |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
all(data).then(({ data }) => { |
||||
uni.hideLoading() |
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === data.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// 筛选确定回调 |
||||
subFinsh(val) { |
||||
const { customerType } = val |
||||
this.customerType = customerType.length ? customerType[0] : '' |
||||
this.initList() |
||||
}, |
||||
// tab切换 |
||||
tabChange(tab) { |
||||
this.curTab = tab.id |
||||
this.initList() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`../clientDetail/clientDetail?customerId=${item.customerId}&show=1`) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 90px; |
||||
} |
||||
.filter { |
||||
display: flex; |
||||
align-items: center; |
||||
.search { |
||||
flex: 1; |
||||
} |
||||
.sl-filter { |
||||
width: 30%; |
||||
margin-left: 10%; |
||||
} |
||||
} |
||||
.list { |
||||
margin-top: 20rpx; |
||||
background-color: #fff; |
||||
li { |
||||
padding: 20rpx 40rpx; |
||||
border-bottom: 1px solid #f1f1f1; |
||||
} |
||||
.c-name { |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
.info { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
margin-top: 10rpx; |
||||
} |
||||
.line { |
||||
display: flex; |
||||
padding: 10rpx 0; |
||||
} |
||||
.name { |
||||
width: 200rpx; |
||||
margin-right: 10rpx; |
||||
font-size: 28rpx; |
||||
color: #999; |
||||
} |
||||
.val { |
||||
max-width: 70%; |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
.type { |
||||
font-size: 28rpx; |
||||
color: #ff7b2d; |
||||
white-space: nowrap; |
||||
} |
||||
} |
||||
</style> |
@ -1,273 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<view class="filter"> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入订单号、内容" v-model="keyword" clearButton="auto" cancelButton="none" /> |
||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons> |
||||
</view> |
||||
|
||||
<template v-if="list.length"> |
||||
<view class="list"> |
||||
<uni-swipe-action> |
||||
<uni-swipe-action-item |
||||
v-for="item in list" |
||||
:threshold="0" |
||||
:right-options="delOption" |
||||
@click="del(item)" |
||||
> |
||||
<view class="item" @click="toDetail(item)"> |
||||
<view class="c-name">{{ item.orderNumber }}</view> |
||||
<view class="info"> |
||||
<view class="left"> |
||||
<view v-if="curTab" class="line"> |
||||
<text class="name">商务经理:</text> |
||||
<text class="val">{{ item.businessManagerName }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">客户名称:</text> |
||||
<text class="val">{{ item.customerName }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">订单金额:</text> |
||||
<text class="val">{{ item.orderAmount }}元</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">订单内容:</text> |
||||
<view class="val ell-wrap"> |
||||
<view :class="{ell: !item.toggle}">{{ item.productName }}</view> |
||||
<view v-if="item.productName.length > 14" class="toggle" @click.stop="toggle(item)">{{ item.toggle ? '收起' : '展开' }}</view> |
||||
</view> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">下单日期:</text> |
||||
<text class="val">{{ item.createTime }}</text> |
||||
</view> |
||||
</view> |
||||
<view :class="['type', 'type' + item.orderStatus]"> |
||||
{{ filterData[0].data.find(e => e.value === item.orderStatus).title }} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</uni-swipe-action-item> |
||||
</uni-swipe-action> |
||||
</view> |
||||
<uni-load-more :status="status" /> |
||||
</template> |
||||
<empty v-else></empty> |
||||
|
||||
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to(`../orderDetail/orderDetail?customerId=${customerId}`)"></uni-icons> |
||||
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { miniProgramOrderRecord, del } from '@/apis/modules/order.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
customerId: '', |
||||
customerName: '', |
||||
popup: false, |
||||
//筛选表单数据 |
||||
filterData: [ |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "订单状态", |
||||
key: "orderStatus", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
isRadio: true, //是否单选 否则多选 |
||||
data: [ |
||||
{ |
||||
title: "待发货", |
||||
value: 0 |
||||
}, |
||||
{ |
||||
title: "已完成", |
||||
value: 1 |
||||
}, |
||||
], |
||||
} |
||||
], |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
filterForm: {}, |
||||
searchTimer: null, |
||||
orderStatus: '', |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
delOption: [{ |
||||
text: '删除', |
||||
style: { |
||||
backgroundColor: '#F56C6C' |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.getList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
const { options } = pages[pages.length - 1] |
||||
this.customerId = options.customerId |
||||
this.customerName = options.name |
||||
// 清除订单缓存 |
||||
try { |
||||
uni.removeStorageSync('orderForm') |
||||
uni.removeStorageSync('courses') |
||||
} catch (e) {} |
||||
this.initList() |
||||
}, |
||||
methods: { |
||||
getList() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
const team = uni.getStorageSync('team') |
||||
const { orderStatus } = this |
||||
miniProgramOrderRecord({ |
||||
businessManagerId: this.$util.getBmId(), |
||||
teamId: team.id, |
||||
customerId: +this.customerId, |
||||
orderStatus: orderStatus === '' ? null : orderStatus, |
||||
isAdmin: +team.isTeam, // 是否是管理员(0否 1是) |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
keywords: this.keyword |
||||
}).then(({ data }) => { |
||||
const { records } = data |
||||
records.map(e => { |
||||
e.toggle = e.productName.length < 14 // 超过了14个字才需要显示展开按钮 |
||||
}) |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...records] : records |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === data.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
uni.hideLoading() |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// 展开 |
||||
toggle(item) { |
||||
item.toggle = !item.toggle |
||||
}, |
||||
// 筛选确定回调 |
||||
subFinsh(val) { |
||||
const { orderStatus } = val |
||||
this.orderStatus = orderStatus.length ? orderStatus[0] : '' |
||||
this.initList() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`) |
||||
}, |
||||
// 删除 |
||||
del(e) { |
||||
const that = this |
||||
uni.showModal({ |
||||
title: '提示', |
||||
content: '确定要删除吗?', |
||||
success(res) { |
||||
if (res.confirm) { |
||||
del({ |
||||
ids: [e.orderId] |
||||
}).then(res => { |
||||
that.$util.sucMsg('删除成功') |
||||
that.getList() |
||||
}).catch(res => {}) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.list { |
||||
margin-top: 20rpx; |
||||
background-color: #fff; |
||||
.item { |
||||
width: 100%; |
||||
padding: 20rpx 40rpx; |
||||
border-bottom: 1px solid #f1f1f1; |
||||
box-sizing: border-box; |
||||
} |
||||
.c-name { |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
.info { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
margin-top: 10rpx; |
||||
} |
||||
.left { |
||||
max-width: 70%; |
||||
} |
||||
.line { |
||||
display: flex; |
||||
padding: 10rpx 0; |
||||
} |
||||
.name { |
||||
margin-right: 10rpx; |
||||
white-space: nowrap; |
||||
font-size: 28rpx; |
||||
color: #999; |
||||
} |
||||
.val { |
||||
max-width: 88%; |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
.ell { |
||||
white-space: nowrap; |
||||
text-overflow: ellipsis; |
||||
overflow: hidden; |
||||
} |
||||
.toggle { |
||||
margin-top: 10rpx; |
||||
white-space: nowrap; |
||||
font-size: 24rpx; |
||||
color: #0e92ef; |
||||
} |
||||
.type { |
||||
margin-left: 20rpx; |
||||
font-size: 28rpx; |
||||
color: #ff7b2d; |
||||
white-space: nowrap; |
||||
} |
||||
.type1 { |
||||
color: #bdbdbd; |
||||
} |
||||
} |
||||
</style> |
@ -1,504 +0,0 @@ |
||||
<template> |
||||
<view class="page"> |
||||
<template v-for="c in courses"> |
||||
<view v-if="c.list.length && c.list.filter(e => !e.edited).length" class="block"> |
||||
<view class="type-wrap"> |
||||
<view class="l-title">{{ c.name }}</view> |
||||
<view class="batch"> |
||||
<input class="deadline" type="number" v-model="c.deadline" placeholder="批量输入" @change="batchDeadlineChange(c)"> |
||||
<view :class="['unit', {placeholder: c.unit === ''}]" @click="batchUnitChange(c)">{{ c.unit !== '' ? units.find(e => e.id === c.unit).text : '请选择' }}</view> |
||||
</view> |
||||
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> |
||||
</view> |
||||
|
||||
<view v-show="!c.shrink"> |
||||
<template v-for="(item, i) in c.list"> |
||||
<view v-if="!item.edited" :key="i"> |
||||
<view class="pro-name"> |
||||
<view class="left"> |
||||
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image> |
||||
{{ item.productName }} |
||||
</view> |
||||
<uni-icons class="del" type="trash" size="25" color="#ADADAD" @click="delCourse(c, i)"></uni-icons> |
||||
</view> |
||||
<view class="form-list"> |
||||
<view class="line"> |
||||
<view class="name">产品类型</view> |
||||
<view class="val">{{ item.typeName }}</view> |
||||
</view> |
||||
<view :class="['line req', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> |
||||
<view class="name">使用期限</view> |
||||
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="dateChange(item, !item.authority)" @change="handleErr(item, 'periodOfUse')"> |
||||
<view class="val unit" @click="selectUnit(item)"> |
||||
<text>{{ units.find(e => e.id === item.options).text }}</text> |
||||
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> |
||||
</view> |
||||
</view> |
||||
<view :class="['line req', {err: err === 'startTime' + item.dataOrCourseId + item.authority}]"> |
||||
<view class="name">起止日期</view> |
||||
<uni-datetime-picker type="date" v-model="item.startTime" :border="false" @change="dateChange(item)"> |
||||
<view :class="['ph', {val: item.startTime}]"> |
||||
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} |
||||
</view> |
||||
</uni-datetime-picker> |
||||
</view> |
||||
<view :class="['line req', {err: err === 'accountNum' + item.dataOrCourseId + item.authority}]"> |
||||
<view class="name">数量</view> |
||||
<view v-if="item.authority" class="val">1</view> |
||||
<input v-else type="number" v-model="item.accountNum" placeholder="请输入账号数量" @input="calcFinalPrice(item)" @change="handleErr(item, 'accountNum')"> |
||||
</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 && 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">{{ item.serviceFee }}元</view> |
||||
</view> |
||||
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]"> |
||||
<view class="name">成交价</view> |
||||
<view class="inline"> |
||||
<input type="number" v-model="item.finalPrice" placeholder="请输入" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')"> |
||||
元 |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
<view class="btn-wrap"> |
||||
<view class="btn" @click="submit">确定</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getOrderOtherTime, queryCitySettlementPrice, renew } from '@/apis/modules/order.js' |
||||
import { getPartnerTeamRates } from '@/apis/modules/parner.js' |
||||
import { productTypeList } from '@/apis/modules/product.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
orderType: 1, |
||||
customerId: '', |
||||
action: '', |
||||
provinceId: '', |
||||
cityId: '', |
||||
timer: null, |
||||
units: [{ |
||||
text: '日', |
||||
id: 0 |
||||
}, { |
||||
text: '月', |
||||
id: 1 |
||||
}, { |
||||
text: '年', |
||||
id: 2 |
||||
}], |
||||
unitText: ['日', '月', '年'], |
||||
courses: {} , // 上一页缓存的产品 |
||||
orderRepeat: [], |
||||
repeatMsg: '', |
||||
err: '', |
||||
rate: '', |
||||
submiting: false, |
||||
} |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
const { options } = pages[pages.length - 1] |
||||
this.orderType = options.orderType |
||||
this.customerId = options.customerId |
||||
this.action = options.action |
||||
this.provinceId = options.provinceId |
||||
this.cityId = options.cityId |
||||
this.handleProduct() |
||||
this.getRate() |
||||
}, |
||||
methods: { |
||||
// 转换产品列表 |
||||
async handleProduct() { |
||||
const list = uni.getStorageSync('courses') |
||||
let courses = {} |
||||
|
||||
// 产品分类 |
||||
productTypeList().then(res => { |
||||
res.typeList.forEach(e => { |
||||
courses['list' + e.typeId] = { |
||||
shrink: false, |
||||
name: e.typeName, |
||||
deadline: '', |
||||
unit: '', |
||||
list: [] |
||||
} |
||||
}) |
||||
const { provinceId, cityId } = this |
||||
const isTrial = this.orderType == 2 |
||||
list.map(async e => { |
||||
// 查询产品管理设置的平台结算价 |
||||
if (provinceId) { |
||||
const res = await queryCitySettlementPrice(e.mallId, provinceId, cityId) |
||||
if (res.mallPrice) e.settlementPriceUnit = res.mallPrice.discountRate || 0 |
||||
} |
||||
// 查询该产品的到期时间 |
||||
const res = await renew({ |
||||
authority: e.authority, |
||||
customerId: this.customerId, |
||||
productId: [e.mallId] |
||||
}) |
||||
|
||||
const item = res.orderOthers |
||||
if (item && item.length) { |
||||
let date = new Date(item[0].endTime) |
||||
date = new Date(date.setDate(date.getDate() + 1)) |
||||
e.startTime = this.$util.formatDate(date, 'yyyy-MM-dd') |
||||
} |
||||
// 试用默认赋值1月后,需要计算结束日期 |
||||
if (isTrial) { |
||||
this.calcDate(e, !e.authority) |
||||
} |
||||
courses['list' + e.typeId].list.push(e) |
||||
}) |
||||
this.courses = courses |
||||
}).catch(e => {}) |
||||
}, |
||||
// 批量设置产品时间 |
||||
batchDeadlineChange (c) { |
||||
c.list.map(e => { |
||||
e.periodOfUse = c.deadline |
||||
this.calcDate(e, !e.authority) |
||||
}) |
||||
}, |
||||
// 批量设置产品期限单位 |
||||
batchUnitChange(c) { |
||||
const that = this |
||||
uni.showActionSheet({ |
||||
title: '标题', |
||||
itemList: that.unitText, |
||||
success: ({ tapIndex }) => { |
||||
if (tapIndex !== '') { |
||||
c.unit = tapIndex |
||||
c.list.map(e => { |
||||
e.options = tapIndex |
||||
that.calcDate(e, !e.authority) |
||||
}) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
// 单个产品选择年月日 |
||||
selectUnit(item) { |
||||
const that = this |
||||
uni.showActionSheet({ |
||||
title: '标题', |
||||
itemList: that.unitText, |
||||
success: ({ tapIndex }) => { |
||||
if (tapIndex !== '') { |
||||
item.options = tapIndex |
||||
that.calcDate(item) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
showUnit(i) { |
||||
this.$refs.unit[i].show() |
||||
}, |
||||
// 收缩产品 |
||||
toggle(c) { |
||||
c.shrink = !c.shrink |
||||
}, |
||||
// 删除课程 |
||||
delCourse(c, i) { |
||||
uni.showModal({ |
||||
title: '提示', |
||||
content: '确定要删除吗?', |
||||
success(res) { |
||||
res.confirm && c.list.splice(i, 1) |
||||
} |
||||
}) |
||||
}, |
||||
// 使用期限输入回调 |
||||
dateChange(row, fromData) { |
||||
clearTimeout(this.timer) |
||||
this.timer = setTimeout(() => { |
||||
this.calcDate(row, fromData) |
||||
}, 500) |
||||
}, |
||||
// 使用期限转换以及计算剩余天数 |
||||
calcDate(row, fromData) { |
||||
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 |
||||
let dt = new Date(endTime) |
||||
row.endTime = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate()) |
||||
let endYear = endTime - time |
||||
let endYears = endYear/1000/60/60/24 |
||||
row.remainingPeriod = endYears |
||||
const unit = row.options // 使用期限单位 |
||||
const useUnit = row.periodOfUse // 使用期限 |
||||
// 计算市场价 |
||||
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) { |
||||
const cId = row.dataOrCourseId |
||||
const date = new Date(row.startTime) |
||||
const orderRepeat = this.orderRepeat |
||||
getOrderOtherTime({ |
||||
authority: row.authority, |
||||
customerId: this.customerId, |
||||
id: cId, |
||||
startTime: this.$util.formatDate(date, 'yyyy-MM-dd'), |
||||
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 = this.$util.formatDate(time, 'yyyy-MM-dd') |
||||
} |
||||
}).catch(res => { |
||||
this.repeatMsg = res.message |
||||
orderRepeat.includes(cId) || orderRepeat.push(cId) |
||||
}) |
||||
} |
||||
// 折扣率 |
||||
this.calcDiscount(row) |
||||
}, |
||||
// 计算结算价及平台服务费 |
||||
dealSettlePrice(row) { |
||||
// 如果是试用或者没选择,结算价和平台服务费都是0 |
||||
if (this.orderType != 1) { |
||||
row.settlementPrice = 0 |
||||
row.serviceFee = 0 |
||||
} else { |
||||
const unit = row.options // 使用期限单位 |
||||
const useUnit = row.periodOfUse // 使用期限 |
||||
let sPrice = '' |
||||
// 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量) |
||||
const priceUnit = row.settlementPriceUnit |
||||
sPrice = ((!unit ? |
||||
priceUnit / 365 * useUnit : |
||||
unit === 1 ? |
||||
priceUnit / 12 * useUnit : |
||||
priceUnit * useUnit) * (row.authority ? |
||||
1 : |
||||
row.accountNum)).toFixed((2)) |
||||
row.settlementPrice = this.$util.handleNaN(sPrice) |
||||
// 平台服务费 |
||||
if (row.settlementPrice) { |
||||
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
||||
} |
||||
} |
||||
}, |
||||
// 查询合伙人团队费率 |
||||
getRate() { |
||||
getPartnerTeamRates({ |
||||
teamId: uni.getStorageSync('team').teamId |
||||
}).then(({ teamRates }) => { |
||||
this.rate = teamRates.annualMarketingFee || 0 |
||||
}).catch(res => {}) |
||||
}, |
||||
// 计算折扣率 |
||||
calcDiscount(row) { |
||||
const price = row.authority ? row.finalPrice : row.finalValue |
||||
const { marketValue } = row |
||||
// (原价-现价)÷原价 x100% |
||||
if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%' |
||||
}, |
||||
// 成交价修改后,计算成交单价,数据才需要 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
||||
calcFinalValue(row) { |
||||
clearTimeout(this.timer) |
||||
this.timer = setTimeout(() => { |
||||
const { authority, periodOfUse, options, accountNum, finalPrice } = row |
||||
if (!authority && periodOfUse && accountNum && finalPrice) { |
||||
row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2) |
||||
} |
||||
// 折扣率 |
||||
this.calcDiscount(row) |
||||
//市场服务费 |
||||
this.dealSettlePrice(row) |
||||
}, 500) |
||||
}, |
||||
// 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
||||
calcFinalPrice(row) { |
||||
clearTimeout(this.timer) |
||||
this.timer = setTimeout(() => { |
||||
const { finalValue, accountNum, periodOfUse, finalPrice } = row |
||||
if (periodOfUse) { |
||||
if (accountNum) { |
||||
// 有成交单价,则成交价=成交单价*账号数*时间 |
||||
if (finalValue) { |
||||
row.finalPrice = Math.round(finalValue * periodOfUse * accountNum) |
||||
} else if (!finalValue && finalPrice) { |
||||
// 有成交价,没有成交单价,则成交单价=成交价/账号数/时间 |
||||
row.finalValue = (finalPrice / periodOfUse / accountNum).toFixed(2) |
||||
this.calcDiscount(row) |
||||
} |
||||
} else if (finalValue && finalPrice && !row.authority) { |
||||
// 有成交价、成交单价,没有数量,则数量=成交价/时间/成交单价 |
||||
row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue) |
||||
} |
||||
} |
||||
this.dealSettlePrice(row) |
||||
}, 500) |
||||
}, |
||||
// 处理错误提示 |
||||
handleErr(e, val) { |
||||
if (val + e.dataOrCourseId + e.authority === this.err) this.err = '' |
||||
}, |
||||
// 确定 |
||||
submit() { |
||||
if (this.submiting) return false |
||||
const { courses } = this |
||||
const list = [] |
||||
let msg = '' |
||||
// 全部产品push到一个数组,方便校验 |
||||
for (const i in courses) { |
||||
list.push(...courses[i].list) |
||||
} |
||||
// 必填校验 |
||||
for (const i in list) { |
||||
const e = list[i] |
||||
const suf = e.dataOrCourseId + '' + e.authority |
||||
if (e.periodOfUse === '') { |
||||
this.err = 'periodOfUse' + suf |
||||
msg = '请输入使用期限!' |
||||
break |
||||
} |
||||
if (e.options === '') { |
||||
this.err = 'accountNum' + suf |
||||
msg = '请选择期限!' |
||||
break |
||||
} |
||||
if (!e.startTime) { |
||||
this.err = 'startTime' + suf |
||||
msg = '请选择起止日期!' |
||||
break |
||||
} |
||||
if (e.accountNum === '') { |
||||
this.err = 'accountNum' + suf |
||||
msg = '请输入数量!' |
||||
break |
||||
} |
||||
if (e.finalPrice === '') { |
||||
this.err = 'finalPrice' + suf |
||||
msg = '请输入成交价!' |
||||
break |
||||
} |
||||
} |
||||
if (msg) return this.$util.errMsg(msg) |
||||
if (this.orderRepeat.length) return this.$util.errMsg(this.repeatMsg) // 有重复订单不能提交 |
||||
this.submiting = true |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
list.forEach(e => { |
||||
e.edited = 1 // 未编辑过的标识,编辑过了的产品在编辑产品页不再显示 |
||||
}) |
||||
uni.setStorageSync('courses', this.courses) |
||||
uni.redirectTo({ |
||||
url: `../orderDetail/orderDetail?edited=1` |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 130rpx; |
||||
-webkit-overflow-scrolling: touch; |
||||
} |
||||
.block { |
||||
position: relative; |
||||
padding: 0; |
||||
.l-title { |
||||
margin: 0 24rpx; |
||||
} |
||||
|
||||
.type-wrap { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
.batch { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
.deadline, .unit { |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
.deadline { |
||||
width: 130rpx; |
||||
} |
||||
.unit { |
||||
min-width: 80rpx; |
||||
text-align: center; |
||||
&.placeholder { |
||||
color: #797979; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.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; |
||||
.period { |
||||
text-align: center; |
||||
} |
||||
.unit { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
.icon { |
||||
width: 28rpx; |
||||
margin-left: 20rpx; |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -1,285 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<view class="filter"> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入产品名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons> |
||||
</view> |
||||
|
||||
<ul class="tab-wrap"> |
||||
<scroll-view scroll-x :scroll-left="scrollLeft" class="tab"> |
||||
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li> |
||||
</scroll-view> |
||||
</ul> |
||||
|
||||
<ul v-if="list.length" class="list"> |
||||
<li v-for="item in list"> |
||||
<view class="pro-name"> |
||||
<image class="icon" :src="item.miniProgramPictureAddress ? item.miniProgramPictureAddress : normalIcon" mode="widthFix"></image> |
||||
{{ item.productName }} |
||||
</view> |
||||
<view class="info"> |
||||
<view class="line"> |
||||
<text class="name">起止日期:</text> |
||||
<text class="val">{{ item.startAndEndTime }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">订阅状态:</text> |
||||
<text class="val">{{ item.status }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">产品状态:</text> |
||||
<text class="val">{{ item.isEnable }}</text> |
||||
</view> |
||||
</view> |
||||
</li> |
||||
</ul> |
||||
<empty v-else></empty> |
||||
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { productCategoryList } from '@/apis/modules/product.js' |
||||
import { getProductsSubscribedByCustomers } from '@/apis/modules/client.js' |
||||
import product from '@/config/product.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
normalIcon: product.normalIcon, |
||||
customerId: '', |
||||
popup: false, |
||||
//筛选表单数据 |
||||
filterData: [ |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "订阅状态", |
||||
key: "orderStatus", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
isRadio: true, //是否单选 否则多选 |
||||
data: [ |
||||
{ |
||||
title: '生效', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
title: '过期', |
||||
value: 2 |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "产品状态", |
||||
key: "productStatus", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
isRadio: true, //是否单选 否则多选 |
||||
data: [ |
||||
{ |
||||
title: '启用', |
||||
value: 1 |
||||
}, |
||||
{ |
||||
title: '禁用', |
||||
value: 2 |
||||
}, |
||||
], |
||||
} |
||||
], |
||||
filterForm: {}, |
||||
curTab: '', |
||||
tabs: [ |
||||
{ |
||||
name: '全部', |
||||
id: '' |
||||
}, |
||||
], |
||||
searchTimer: null, |
||||
orderStatus: '', |
||||
productStatus: '', |
||||
keyword: '', |
||||
list: [], |
||||
listAll: [], |
||||
page: 1, |
||||
pageSize: 10 |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.filter() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.getList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
this.customerId = pages[pages.length - 1].options.customerId |
||||
this.getTypes() |
||||
this.getList() |
||||
}, |
||||
methods: { |
||||
getList() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
getProductsSubscribedByCustomers({ |
||||
customeId: this.customerId |
||||
}).then(({ data }) => { |
||||
const { tabs } = this |
||||
data.map(e => { |
||||
const list = e.startAndEndTimeList |
||||
if (list && list.length) { |
||||
let connect = true // 每个订单的开始结束日期是否连续 |
||||
list.map((n, i) => { |
||||
// 第一个不用计算。用当前订单的开始日期跟上一个订单的结束日期做比较,只差一天,就表示是连续订单 |
||||
if (i) { |
||||
if (new Date(n.startTime).getTime() - 86400000 !== new Date(list[i - 1].endTime).getTime()) connect = false |
||||
} |
||||
}) |
||||
// // 如果是连续订单,则取第一个订单的开始日期和最后一个订单的结束日期 |
||||
const now = Date.now() |
||||
if (now < list[0].startTime) { |
||||
e.startTime = list[0].startTime |
||||
e.endTime = connect ? list[list.length - 1].endTime : list[0].endTime |
||||
e.status = '未生效' |
||||
} else if (now > list[list.length - 1].endTime) { |
||||
e.status = '已过期' |
||||
} else { |
||||
// 连续订单 |
||||
if (connect) { |
||||
e.startTime = list[0].startTime |
||||
e.endTime = list[list.length - 1].endTime |
||||
e.status = '生效中' |
||||
e.orderEnable = list[0].isEnable |
||||
} else { |
||||
for (const i in list) { |
||||
const n = list[i] |
||||
if (now >= new Date(n.startTime).getTime() && now <= new Date(n.endTime).getTime()) { |
||||
// 生效中的订单,直接取该订单的开始结束日期 |
||||
e.startTime = n.startTime |
||||
e.endTime = n.endTime |
||||
e.status = '生效中' |
||||
e.orderEnable = n.isEnable |
||||
break |
||||
} else if (i && list[i - 1] && now > new Date(list[i - 1].endTime).getTime() && now < new Date(n.startTime).getTime()) { |
||||
// 当前时间位于两个订单时间之间,则取次订单的开始结束日期,并且为未生效 |
||||
e.startTime = n.startTime |
||||
e.endTime = n.endTime |
||||
e.status = '未生效' |
||||
e.orderEnable = n.isEnable |
||||
break |
||||
} else { |
||||
e.status = '已过期' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
const date = new Date() |
||||
date.setHours(0) |
||||
date.setMinutes(0) |
||||
date.setSeconds(0) |
||||
if (e.startTime) e.startAndEndTime = e.startTime + ' ~ ' + e.endTime |
||||
// 1开启 0禁用(已过期的订单,或者当前生效的订单为禁用,则显示为禁用,否则是启用) |
||||
e.isEnable = (e.status === '已过期' || !e.orderEnable) ? '禁用' : '启用' |
||||
} |
||||
}) |
||||
this.list = data |
||||
this.listAll = data |
||||
uni.hideLoading() |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
// 产品分类 |
||||
getTypes() { |
||||
productCategoryList().then(res => { |
||||
res.classificationList.forEach(e => { |
||||
e.id = e.classificationId |
||||
e.name = e.classificationName |
||||
}) |
||||
this.tabs.push(...res.classificationList) |
||||
}).catch(e => {}) |
||||
}, |
||||
// 筛选确定回调 |
||||
subFinsh(val) { |
||||
const { orderStatus, productStatus } = val |
||||
this.orderStatus = orderStatus.length ? orderStatus[0] : '' |
||||
this.productStatus = productStatus.length ? productStatus[0] : '' |
||||
this.filter() |
||||
}, |
||||
// 筛选 |
||||
filter() { |
||||
const list = this.listAll |
||||
const { orderStatus, productStatus, keyword, curTab } = this |
||||
this.list = list.filter(e => (orderStatus === '' || ((orderStatus === 2 && e.status === '已过期') || (orderStatus === 1 && e.status === '生效中'))) && (productStatus === '' || ((productStatus === 2 && e.isEnable === '禁用') || (productStatus === 1 && e.isEnable === '启用'))) && e.productName.includes(keyword) && (curTab === '' || (curTab === e.productType))) |
||||
}, |
||||
// tab切换 |
||||
tabChange(tab) { |
||||
this.curTab = tab.id |
||||
this.filter() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`../clientDetail/clientDetail?customerId=${item.customerId}&show=1`) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.filter { |
||||
margin-bottom: 10px; |
||||
} |
||||
.tab-wrap { |
||||
.tab { |
||||
width: 100%; |
||||
white-space: nowrap; |
||||
li { |
||||
display: inline-block; |
||||
} |
||||
} |
||||
} |
||||
.list { |
||||
li { |
||||
padding: 0 24rpx; |
||||
margin: 16rpx 24rpx; |
||||
background-color: #fff; |
||||
border-radius: 16rpx; |
||||
} |
||||
.pro-name { |
||||
display: flex; |
||||
align-items: center; |
||||
padding: 18rpx 0; |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
border-bottom: 1px solid #E6E8ED; |
||||
.icon { |
||||
width: 52rpx; |
||||
margin-right: 20rpx; |
||||
} |
||||
} |
||||
.info { |
||||
padding: 12rpx 0; |
||||
} |
||||
.line { |
||||
display: flex; |
||||
padding: 12rpx 0; |
||||
} |
||||
.name { |
||||
margin-right: 10rpx; |
||||
font-size: 28rpx; |
||||
color: #999; |
||||
} |
||||
.val { |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
} |
||||
</style> |
@ -1,399 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<view class="filter"> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入产品名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons> |
||||
</view> |
||||
|
||||
<ul class="tab-wrap"> |
||||
<view class="tab"> |
||||
<li :class="{active: curTab === ''}" @click="tabChange('')">全部</li> |
||||
</view> |
||||
|
||||
<scroll-view scroll-x :scroll-left="scrollLeft" class="tab tab-scroll"> |
||||
<li v-for="(tab, i) in tabs" :key="i" :class="{active: curTab === tab.value}" @click="tabChange(tab.value)">{{ tab.title }}</li> |
||||
</scroll-view> |
||||
</ul> |
||||
|
||||
<view class="tags"> |
||||
<view v-if="categoryName" class="tag" @click="delCategory"> |
||||
{{ categoryName }} |
||||
<uni-icons class="icon" type="closeempty" size="15" color="#007EFF"></uni-icons> |
||||
</view> |
||||
<view v-if="productTypeName" class="tag" @click="delProductType"> |
||||
{{ productTypeName }} |
||||
<uni-icons class="icon" type="closeempty" size="15" color="#007EFF"></uni-icons> |
||||
</view> |
||||
<view v-if="form.selection" class="tag" @click="delSelection"> |
||||
官方精选 |
||||
<uni-icons class="icon" type="closeempty" size="15" color="#007EFF"></uni-icons> |
||||
</view> |
||||
<view v-if="tagName" class="tag" @click="delTag"> |
||||
{{ tagName }} |
||||
<uni-icons class="icon" type="closeempty" size="15" color="#007EFF"></uni-icons> |
||||
</view> |
||||
</view> |
||||
|
||||
<ul class="list"> |
||||
<li v-for="(item, i) in list" :key="i" @click="toDetail(item)"> |
||||
<view class="pro-name"> |
||||
<image class="icon" :src="$util.getIcon(item)"></image> |
||||
{{ item.productName }} |
||||
</view> |
||||
<view class="info"> |
||||
<view class="line"> |
||||
<text class="name">产品简介:</text> |
||||
<view class="val ell-wrap"> |
||||
<view class="ell">{{ item.productIntroduction }}</view> |
||||
</view> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">产品类型:</text> |
||||
<text class="val">{{ item.typeName }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">适用专业:</text> |
||||
<text class="val">{{ item.professionalName }}</text> |
||||
</view> |
||||
<view class="line"> |
||||
<text class="name">市场建议单价:</text> |
||||
<text class="val">{{ item.marketUnitPrice }}元/年</text> |
||||
</view> |
||||
</view> |
||||
</li> |
||||
</ul> |
||||
|
||||
<view v-if="auth('产品:购物车')" class="plus"> |
||||
<uni-badge size="small" :text="total" absolute="topRight" type="error"> |
||||
<image class="icon" src="@/static/image/product/shop-blue.png" mode="widthFix" @click="$util.to('../shopCart/shopCart')"></image> |
||||
</uni-badge> |
||||
</view> |
||||
|
||||
<filter-popup ref="filter" showCategory :data="filters" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { tagsList, listOfGoods, productTypeList, shoppingCartList } from '@/apis/modules/product.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
popup: false, |
||||
//筛选表单数据 |
||||
filters: [ |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "产品类型", |
||||
key: "productType", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
isRadio: true, //是否单选 否则多选 |
||||
data: [], |
||||
}, |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "官方精选", |
||||
key: "selection", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
data: [ |
||||
{ |
||||
value: 1, |
||||
title: '官方精选' |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
children: false,//是否有子项 |
||||
title: "产品标签", |
||||
key: "tagId", //键名 接收对象名字 |
||||
keyValue: "value", //获取的值是哪个 |
||||
isRadio: true, //是否单选 否则多选 |
||||
data: [], |
||||
}, |
||||
], |
||||
filterForm: { |
||||
productType: [], |
||||
selection: [], |
||||
tagId: [] |
||||
}, |
||||
form: { |
||||
categoryId: '', |
||||
professionalCategoryId: '', |
||||
professionalId: '', |
||||
productType: '', |
||||
selection: '', |
||||
tagId: '' |
||||
}, |
||||
tagId: '', |
||||
curTab: '', |
||||
tabs: [], |
||||
scrollLeft: 0, |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
sort: 0, |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
cartNum: '', |
||||
productTypeName: '', |
||||
tagName: '', |
||||
categoryName: '', |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
const { options } = pages[pages.length - 1] |
||||
const { tagId, tagsName } = options |
||||
this.form.tagId = +tagId || '' |
||||
if (tagId) { |
||||
this.filterForm.tagId = [+tagId] |
||||
// this.tagName = tagsName |
||||
} |
||||
|
||||
this.keyword = options.keyword || '' |
||||
this.page = 1 |
||||
this.getList() |
||||
this.getFilter() |
||||
this.getShopCart() |
||||
}, |
||||
methods: { |
||||
getList() { |
||||
listOfGoods({ |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
sort: 0, |
||||
isShelves: 0, |
||||
hotTag: this.form.tagId ? 2 : 1, |
||||
...this.form, |
||||
productName: this.keyword, |
||||
productType: this.curTab |
||||
}).then(({ page }) => { |
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
const list = page.records |
||||
list.map(e => { |
||||
e.productIntroduction = this.$util.removeTag(e.productIntroduction) |
||||
}) |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === page.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
}).catch(e => {}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// 获取购物车数量 |
||||
getShopCart() { |
||||
shoppingCartList({ |
||||
pageNum: 1, |
||||
pageSize: 1000, |
||||
}).then(({ data }) => { |
||||
this.total = data.total |
||||
}).catch(e => {}) |
||||
}, |
||||
// 筛选 |
||||
getFilter() { |
||||
// 产品类型 |
||||
productTypeList().then(res => { |
||||
res.typeList.forEach(e => { |
||||
e.value = e.typeId |
||||
e.title = e.typeName |
||||
}) |
||||
this.tabs = res.typeList |
||||
this.filters[0].data = res.typeList |
||||
}).catch(e => {}) |
||||
|
||||
// 产品标签 |
||||
tagsList().then(res => { |
||||
res.tagsList.forEach(e => { |
||||
e.value = e.tagsId |
||||
e.title = e.tagsName |
||||
}) |
||||
this.filters[2].data = res.tagsList |
||||
}).catch(e => {}) |
||||
}, |
||||
// 筛选确定回调 |
||||
subFinsh(val) { |
||||
const { productType, selection, tagId, categoryId, professionalCategoryId, professionalId, categoryName } = val |
||||
this.form = { |
||||
categoryId: categoryId || '', |
||||
professionalCategoryId: professionalCategoryId || '', |
||||
professionalId: professionalId || '', |
||||
productType: productType.length ? productType[0] : '', |
||||
selection: selection.length ? selection[0] : '', |
||||
tagId: tagId.length ? tagId[0] : '' |
||||
} |
||||
this.categoryName = categoryName || '' |
||||
this.productTypeName = this.form.productType ? this.filters[0].data.find(e => e.value == this.form.productType).title : '' |
||||
this.tagName = this.form.tagId ? this.filters[2].data.find(e => e.value == this.form.tagId).title : '' |
||||
this.initList() |
||||
}, |
||||
// 删除学科专业已选 |
||||
delCategory() { |
||||
this.$refs.filter.category = [] |
||||
this.$refs.filter.categoryName = '' |
||||
this.$refs.filter.categoryId = '' |
||||
this.$refs.filter.professionalCategoryId = '' |
||||
this.$refs.filter.professionalId = '' |
||||
this.form.categoryId = '' |
||||
this.form.professionalCategoryId = '' |
||||
this.form.professionalId = '' |
||||
this.categoryName = '' |
||||
this.initList() |
||||
}, |
||||
// 删除产品类型已选 |
||||
delProductType() { |
||||
this.filterForm.productType = [] |
||||
this.form.productType = '' |
||||
this.productTypeName = '' |
||||
this.initList() |
||||
}, |
||||
// 删除官方精选已选 |
||||
delSelection() { |
||||
this.filterForm.selection = [] |
||||
this.form.selection = '' |
||||
this.initList() |
||||
}, |
||||
// 删除产品标签已选 |
||||
delTag() { |
||||
this.filterForm.tagId = [] |
||||
this.form.tagId = '' |
||||
this.tagName = '' |
||||
this.initList() |
||||
}, |
||||
// tab切换 |
||||
tabChange(id) { |
||||
this.curTab = id |
||||
this.initList() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
console.log(44, item) |
||||
this.$util.to(`../productDetail/productDetail?id=${item.mallId}`) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.tab-wrap { |
||||
display: flex; |
||||
.tab-scroll { |
||||
width: calc(100% - 100rpx); |
||||
white-space: nowrap; |
||||
li { |
||||
display: inline-block; |
||||
} |
||||
} |
||||
} |
||||
.tags { |
||||
display: flex; |
||||
align-items: center; |
||||
flex-wrap: wrap; |
||||
padding: 0 24rpx; |
||||
.tag { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
padding: 10rpx 14rpx; |
||||
margin: 0 20rpx 16rpx 0; |
||||
font-size: 28rpx; |
||||
color: #007EFF; |
||||
background-color: #fff; |
||||
border-radius: 4px; |
||||
} |
||||
.icon { |
||||
margin-left: 6rpx; |
||||
} |
||||
} |
||||
.list { |
||||
li { |
||||
padding: 0 24rpx; |
||||
margin: 16rpx 24rpx; |
||||
background-color: #fff; |
||||
border-radius: 16rpx; |
||||
} |
||||
.pro-name { |
||||
display: flex; |
||||
align-items: center; |
||||
padding: 18rpx 0; |
||||
font-size: 30rpx; |
||||
font-weight: 600; |
||||
color: #333; |
||||
border-bottom: 1px solid #E6E8ED; |
||||
.icon { |
||||
width: 58rpx; |
||||
min-width: 58rpx; |
||||
height: 58rpx; |
||||
margin-right: 20rpx; |
||||
border-radius: 4px; |
||||
} |
||||
} |
||||
.info { |
||||
padding: 12rpx 0; |
||||
} |
||||
.line { |
||||
display: flex; |
||||
padding: 12rpx 0; |
||||
} |
||||
.name { |
||||
margin-right: 10rpx; |
||||
font-size: 28rpx; |
||||
color: #999; |
||||
} |
||||
.val { |
||||
max-width: 70%; |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
.ell-wrap { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
} |
||||
.ell { |
||||
white-space: nowrap; |
||||
text-overflow: ellipsis; |
||||
overflow: hidden; |
||||
} |
||||
.toggle { |
||||
margin-left: 10rpx; |
||||
white-space: nowrap; |
||||
font-size: 24rpx; |
||||
color: #0e92ef; |
||||
} |
||||
} |
||||
.plus { |
||||
bottom: 140rpx; |
||||
right: 60rpx; |
||||
.icon { |
||||
width: 102rpx; |
||||
} |
||||
} |
||||
</style> |
@ -1,317 +0,0 @@ |
||||
<template> |
||||
<view class="page"> |
||||
<ul class="list"> |
||||
<uni-swipe-action> |
||||
<uni-swipe-action-item |
||||
v-for="(item, i) in list" |
||||
:key="i" |
||||
:threshold="0" |
||||
:right-options="delOption" |
||||
@click="del(item)" |
||||
> |
||||
<li> |
||||
<uni-data-checkbox v-if="item.check" class="check" multiple :value="[1]" :localdata="item.checkData" @change="e => checkChange(e, i)"></uni-data-checkbox> |
||||
<uni-data-checkbox v-else class="check" multiple v-model="item.check" :localdata="item.checkData" @change="e => checkChange(e, i)"></uni-data-checkbox> |
||||
<image class="icon" :src="$util.getIcon(item)"></image> |
||||
<view class="texts"> |
||||
<view class="name">{{ item.productName }}</view> |
||||
<view class="price">市场建议价:{{ item.marketUnitPrice }}元/年</view> |
||||
</view> |
||||
</li> |
||||
</uni-swipe-action-item> |
||||
</uni-swipe-action> |
||||
</ul> |
||||
<uni-load-more :status="status" /> |
||||
|
||||
<view class="btn-wrap"> |
||||
<uni-data-checkbox class="check" multiple v-model="checkAll" :localdata="checkAllData" @change="allChange"></uni-data-checkbox> |
||||
<view class="btns"> |
||||
<view class="btn del" @click="batchDel">删除</view> |
||||
<view class="btn" @click="submit">生成订单</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { shoppingCartList, delCart, detailsOfGoods } from '@/apis/modules/product.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
check: [1], |
||||
noCheck: [], |
||||
checkData: [{ |
||||
text: '', |
||||
value: 1 |
||||
}], |
||||
checkAll: [], |
||||
checkAllData: [{ |
||||
text: '全部', |
||||
value: 1 |
||||
}], |
||||
checked: [], // 已经勾选的集合 |
||||
delOption: [{ |
||||
text: '删除', |
||||
style: { |
||||
backgroundColor: '#F56C6C' |
||||
} |
||||
}], |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.checked = [] |
||||
// 清除产品缓存 |
||||
try { |
||||
uni.removeStorageSync('orderForm') |
||||
uni.removeStorageSync('courses') |
||||
uni.removeStorageSync('orderEdited') |
||||
} catch (e) {} |
||||
this.initList() |
||||
}, |
||||
methods: { |
||||
// 购物车列表 |
||||
getList() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
shoppingCartList({ |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
}).then(({ data }) => { |
||||
const { records } = data |
||||
const all = this.checkAll.length // 是否勾选了全选 |
||||
const pageChange = this.reachBottom > 0 // 是否是翻页 |
||||
// 添加选择框字段 |
||||
records.forEach(e => { |
||||
e.check = 0 |
||||
e.checkData = [{ |
||||
text: '', |
||||
value: 1 |
||||
}] |
||||
}) |
||||
|
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
this.list = pageChange ? [...this.list, ...records] : records |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === data.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
uni.hideLoading() |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// 选择框回调 |
||||
checkChange(e, i) { |
||||
const { checked } = this |
||||
const item = this.list[i] |
||||
const { id } = item |
||||
const include = checked.findIndex(e => e.id === id) |
||||
// 选中的情况下,该产品如果没有push到已选数组里,则push |
||||
if (e.detail.value.length) { |
||||
include === -1 && checked.push(item) |
||||
} else { |
||||
// 取消选中的情况下,如果已选数组里存在该产品,则移除 |
||||
if (include !== -1) { |
||||
checked.splice(include, 1) |
||||
this.checkAll = [] |
||||
} |
||||
} |
||||
console.log(11, checked) |
||||
}, |
||||
// 全选 |
||||
allChange(e) { |
||||
const isCheck = !!e.detail.value.length // 是否选中 |
||||
const { list } = this |
||||
this.checked = isCheck ? JSON.parse(JSON.stringify(list)) : [] |
||||
list.forEach(e => { |
||||
e.check = isCheck ? 1 : 0 |
||||
}) |
||||
}, |
||||
// 生成产品参数 |
||||
createParam(e, authority, shopCartId) { |
||||
const { orderType } = this |
||||
const { mall, typeIds } = e |
||||
const trial = orderType == 2 // 是否是试用 |
||||
return { |
||||
dataOrCourseId: mall.associatedProduct, // id |
||||
mallId: mall.mallId, |
||||
productName: mall.productName, // 名称 |
||||
periodOfUse: '', // 使用期限 |
||||
startTime: this.$util.formatDate(new Date(), 'yyyy-MM-dd'), // 开始 |
||||
endTime: '', // 终止 |
||||
remainingPeriod: '', // 剩余期限 |
||||
marketValue: '', // 市场价 |
||||
marketPrice: mall.marketUnitPrice, // 市场单价 |
||||
finalPrice: 0, // 成交价 |
||||
finalValue: 0, // 成交单价(数据产品特有) |
||||
discountRate: '0%', // 折扣率 |
||||
accountNum: 1, // 账号数 |
||||
totalAmount: '', // 总价 |
||||
isEnable: 0, // 启用否:1启用,0禁用 |
||||
ship: 0, // 发货否(0未发货,1已发货,默认不发货) |
||||
authority, // 区分权限 0为数据平台权限,1为课程权限 |
||||
options: 2, |
||||
miniProgramPictureAddress: mall.appletIcon || '', // 图标 |
||||
settlementPrice: trial ? 0 : '', // 结算价 |
||||
settlementPriceUnit: 0, // 结算单价 |
||||
serviceFee: 0, // 平台服务费(前端计算后展示,不入库) |
||||
shopCartId, // 购物车id,订单提交后,调删除购物车的接口把这个产品删除 |
||||
typeId: typeIds && typeIds.length ? typeIds[0] : '', |
||||
} |
||||
}, |
||||
// 删除 |
||||
del(e) { |
||||
const that = this |
||||
uni.showModal({ |
||||
title: '提示', |
||||
content: '确定要删除吗?', |
||||
success(res) { |
||||
if (res.confirm) { |
||||
delCart([e.id]).then(res => { |
||||
that.initList() |
||||
}).catch(e => {}) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
// 批量删除 |
||||
batchDel() { |
||||
const list = this.checked // 已选产品 |
||||
if (list.length) { |
||||
const that = this |
||||
uni.showModal({ |
||||
title: '提示', |
||||
content: '确定要删除吗?', |
||||
success(res) { |
||||
if (res.confirm) { |
||||
delCart(list.map(e => e.id)).then(res => { |
||||
that.checkAll = [] |
||||
that.checked = [] |
||||
that.initList() |
||||
}).catch(e => {}) |
||||
} |
||||
} |
||||
}) |
||||
} else { |
||||
this.$util.errMsg('请选择产品!') |
||||
} |
||||
}, |
||||
// 确定 |
||||
submit() { |
||||
const list = this.checked // 已选产品 |
||||
if (list.length) { |
||||
// 判断勾选的产品是否有重复的 |
||||
if (new Set(list.map(e => e.mallId)).size !== list.length) return this.$util.errMsg('所选产品存在重复,请重新选择') |
||||
|
||||
const promises = [] |
||||
let courses = [] |
||||
list.forEach(e => { |
||||
promises.push(new Promise(async (resolve, reject) => { |
||||
// 查询产品详情 |
||||
const res = await detailsOfGoods(e.mallId) |
||||
const n = res.orderDetails |
||||
courses.push(this.createParam(n, this.$util.getOrderType(n.classificationIds[0]), e.id)) |
||||
resolve() |
||||
})) |
||||
}) |
||||
Promise.all(promises).then(_ => { |
||||
uni.setStorageSync('courses', courses) |
||||
this.$util.to(`../orderDetail/orderDetail?shopCart=1`) |
||||
}) |
||||
} else { |
||||
this.$util.errMsg('请先添加产品!') |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 130rpx; |
||||
} |
||||
.list { |
||||
li { |
||||
display: flex; |
||||
align-items: center; |
||||
width: 100%; |
||||
padding: 30rpx 24rpx; |
||||
margin: 16rpx 24rpx; |
||||
background-color: #fff; |
||||
border-radius: 16rpx; |
||||
box-sizing: border-box; |
||||
} |
||||
.name { |
||||
margin-bottom: 10rpx; |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
.price { |
||||
font-size: 26rpx; |
||||
color: #333; |
||||
} |
||||
.icon { |
||||
width: 100rpx; |
||||
min-width: 100rpx; |
||||
height: 100rpx; |
||||
margin: 0 20rpx; |
||||
border-radius: 4px; |
||||
} |
||||
} |
||||
/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 { |
||||
position: fixed; |
||||
justify-content: space-between; |
||||
.btns { |
||||
display: inline-flex; |
||||
} |
||||
.btn { |
||||
width: auto; |
||||
padding: 0 50rpx; |
||||
} |
||||
.del { |
||||
margin-right: 20rpx; |
||||
background-color: #b5b5b5; |
||||
} |
||||
} |
||||
</style> |
Before Width: | Height: | Size: 775 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 518 B |
Before Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 734 B |
Before Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 641 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 1007 B |
Before Width: | Height: | Size: 510 B |
Before Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 974 B |
Before Width: | Height: | Size: 760 B |
Before Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 773 B |
Before Width: | Height: | Size: 624 B |
@ -1,61 +0,0 @@ |
||||
<template> |
||||
<view class="page"> |
||||
<view class="input"> |
||||
<uni-easyinput v-model.trim="account" placeholder="请输入账号" @input="accountChange"></uni-easyinput> |
||||
</view> |
||||
<button type="primary" @click="submit">确认</button> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { checkIfAnAccountExists, changeAccount } from '@/apis/modules/user.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
timer: null, |
||||
account: '', |
||||
repeat: false |
||||
} |
||||
}, |
||||
onShow() { |
||||
|
||||
}, |
||||
methods: { |
||||
// 账号判重 |
||||
accountChange() { |
||||
clearTimeout(this.timer) |
||||
this.timer = setTimeout(() => { |
||||
checkIfAnAccountExists(this.account).then(() => { |
||||
this.repeat = false |
||||
}).catch(e => { |
||||
this.repeat = true |
||||
}) |
||||
}, 500) |
||||
}, |
||||
submit() { |
||||
const { account } = this |
||||
if(!account) return this.$util.errMsg('请输入账号') |
||||
if (this.repeat) return this.$util.errMsg('账号已存在!') |
||||
changeAccount(account).then(res => { |
||||
this.$util.sucMsg('修改成功!') |
||||
setTimeout(() => { |
||||
uni.navigateBack() |
||||
}, 1000) |
||||
}).catch(e => {}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding: 20px; |
||||
background-color: #fff; |
||||
} |
||||
/deep/.input { |
||||
margin-bottom: 15px; |
||||
.is-input-border { |
||||
border-color: #dedede !important; |
||||
} |
||||
} |
||||
</style> |
@ -1,51 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<uni-section title="邀请成员" type="line"> |
||||
<uni-list> |
||||
<uni-list-item thumb-size="sm" showArrow title="二维码邀请" clickable :to="`../qrcode/qrcode`"> |
||||
<template v-slot:header> |
||||
<view class="slot-box"> |
||||
<image class="icon" src="@/static/image/qrcode.png" mode="widthFix"></image> |
||||
</view> |
||||
</template> |
||||
<template v-slot:body> |
||||
<text class="slot-box text">二维码邀请</text> |
||||
</template> |
||||
</uni-list-item> |
||||
</uni-list> |
||||
</uni-section> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
extraIcon: { |
||||
color: '#007eff', |
||||
size: '22', |
||||
type: 'icon-qrcode' |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
|
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.slot-box { |
||||
display: flex; |
||||
flex-direction: row; |
||||
align-items: center; |
||||
} |
||||
.icon { |
||||
width: 25px; |
||||
height: 25px; |
||||
margin-right: 10px; |
||||
} |
||||
.text { |
||||
font-size: 14px; |
||||
} |
||||
</style> |
@ -1,222 +0,0 @@ |
||||
<template> |
||||
<view class="page"> |
||||
<view class="block"> |
||||
<view class="title">上传营业执照</view> |
||||
<image class="credential" :src="businessLicensePicture || 'http://124.71.79.122/images/miniProgram/credentials1.png'" mode="widthFix" @click="uploadBusinessLicense"></image> |
||||
</view> |
||||
|
||||
<view v-if="isPreschool" class="block"> |
||||
<view class="title">上传办学许可证</view> |
||||
<image class="credential" :src="licenseForRunningSchool || 'http://124.71.79.122/images/miniProgram/credentials2.png'" mode="widthFix" @click="uploadSchoolLicense"></image> |
||||
</view> |
||||
|
||||
<view class="block"> |
||||
<view class="form-list"> |
||||
<view class="line with-arrow"> |
||||
<view class="name">{{ isPreschool ? '幼儿园' : '企业' }}名称</view> |
||||
<input type="text" :placeholder="'请输入' + platformName + '名称'" v-model="form.companyName" /> |
||||
<uni-icons type="right" size="18" color="#ababab"></uni-icons> |
||||
</view> |
||||
<view class="line with-arrow"> |
||||
<view class="name">统一社会信用代码</view> |
||||
<input type="text" placeholder="请输入证件号码" v-model="form.creditCode" /> |
||||
<uni-icons type="right" size="18" color="#ababab"></uni-icons> |
||||
</view> |
||||
<view class="line with-arrow"> |
||||
<view class="name">法人</view> |
||||
<input type="text" placeholder="请输入法人" v-model="form.legalPerson" /> |
||||
<uni-icons type="right" size="18" color="#ababab"></uni-icons> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<view class="btn-wrap"> |
||||
<view class="btn" @click="submit">认证信息</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import OSS from '@/libs/Oss/upload' |
||||
export default { |
||||
data() { |
||||
return { |
||||
openId: uni.getStorageSync('openId'), |
||||
form: { |
||||
companyName: '', |
||||
creditCode: '', |
||||
legalPerson: '', |
||||
}, |
||||
platformId: '', |
||||
businessLicensePicture: '', |
||||
licenseForRunningSchool: '', |
||||
} |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
const { options } = pages[pages.length - 1] |
||||
// this.getEnterInfo() |
||||
}, |
||||
methods: { |
||||
// 企业认证信息 |
||||
async getEnterInfo() { |
||||
const res = await enterpriseCertificationStatus(this.openId) |
||||
if (res.data) { |
||||
const { data } = res |
||||
this.businessLicensePicture = data.businessLicensePicture || '' |
||||
this.licenseForRunningSchool = data.licenseForRunningSchool || '' |
||||
this.form.companyName = data.companyName || '' |
||||
this.form.creditCode = data.creditCode || '' |
||||
this.form.legalPerson = data.legalPerson || '' |
||||
this.form.address = data.address || '' |
||||
this.form.business = data.business || '' |
||||
this.form.capital = data.capital || '' |
||||
this.form.establishDate = data.establishDate || '' |
||||
this.form.type = data.type || '' |
||||
this.form.validPeriod = data.validPeriod || '' |
||||
this.form.platformSource = this.platformId |
||||
} |
||||
}, |
||||
// 上传营业执照 |
||||
uploadBusinessLicense() { |
||||
const that = this |
||||
uni.chooseImage({ |
||||
success: (res) => { |
||||
const file = res.tempFilePaths[0]; |
||||
OSS(file, async ({ url }) => { |
||||
that.businessLicensePicture = url |
||||
const { data } = await businessLicensePictureVerification(url) |
||||
if (data) { |
||||
that.form = { |
||||
companyName: data.name, |
||||
creditCode: data.reg_num, |
||||
legalPerson: data.person, |
||||
address: data.address, |
||||
business: data.business, |
||||
capital: data.capital, |
||||
establishDate: data.establish_date, |
||||
type: data.type, |
||||
validPeriod: data.valid_period, |
||||
platformSource: this.platformId, |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
}); |
||||
}, |
||||
// 上传办学许可证 |
||||
uploadSchoolLicense() { |
||||
const that = this |
||||
uni.chooseImage({ |
||||
success: (res) => { |
||||
const file = res.tempFilePaths[0]; |
||||
OSS(file, async ({ url }) => { |
||||
that.licenseForRunningSchool = url |
||||
}) |
||||
} |
||||
}); |
||||
}, |
||||
// 消息推送授权 |
||||
publicNotice() { |
||||
const that = this |
||||
uni.requestSubscribeMessage({ |
||||
tmplIds: ['ZB6wTenlv13mivxXwi-DWwjgVoNJ6eUr1vBvNdQGbJw'], |
||||
success: (res) => { |
||||
uni.setStorageSync('platformId', that.platformId) |
||||
const name = that.platformId == 6 ? '供应商' : '幼儿园' |
||||
that.$util.errMsg(`您已成功提交${name}认证,现在为您切换到${name}端。`) |
||||
setTimeout(() => { |
||||
uni.switchTab({ |
||||
url: '/pages/person/person' |
||||
}) |
||||
}, 2000) |
||||
}, |
||||
fail: function(err) { |
||||
uni.showToast({ |
||||
title: err, |
||||
duration: 2000, |
||||
icon: 'error' |
||||
}); |
||||
} |
||||
}) |
||||
}, |
||||
// 提交 |
||||
async submit() { |
||||
if (this.submiting) return false |
||||
const { form } = this |
||||
if (!form.companyName) return this.$util.errMsg(`请输入${platformName}名称!`) |
||||
if (!form.creditCode) return this.$util.errMsg('请输入统一社会信用代码!') |
||||
if (!form.legalPerson) return this.$util.errMsg('请输入法人!') |
||||
this.submiting = true |
||||
uni.showLoading({ |
||||
title: '提交中' |
||||
}) |
||||
const data = { |
||||
...form, |
||||
auditStatus: 1, |
||||
authenticationStatus: 1, |
||||
businessLicensePicture: this.businessLicensePicture, |
||||
licenseForRunningSchool: this.licenseForRunningSchool, |
||||
openId: this.openId |
||||
} |
||||
try { |
||||
// 个人 |
||||
if (uni.getStorageSync('platformId') === 7) { |
||||
// 个人认证企业后新增一个企业角色 |
||||
const res = await kindergartenWeChatApplication({ |
||||
openId: this.openId, |
||||
platformId: this.platformId, |
||||
organizationName: form.companyName |
||||
}) |
||||
|
||||
data.accountId = res.data.registerId |
||||
await organizationCertification(data) |
||||
} else { // 幼儿园/供应商 |
||||
await creditCodeAuthentication(data) |
||||
|
||||
// 企业认证后要修改组织名字 |
||||
await updateTeamInfo({ |
||||
id: uni.getStorageSync('teamId'), |
||||
classificationName: form.companyName |
||||
}) |
||||
} |
||||
uni.hideLoading() |
||||
this.publicNotice() |
||||
} catch(e) { |
||||
setTimeout(() => { |
||||
uni.hideLoading() |
||||
}, 1500) |
||||
this.submiting = false |
||||
} |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 170rpx; |
||||
-webkit-overflow-scrolling: touch; |
||||
} |
||||
.avatar { |
||||
width: 80rpx; |
||||
height: 80rpx; |
||||
border: 0; |
||||
border-radius: 50%; |
||||
} |
||||
.block { |
||||
padding: 24rpx; |
||||
} |
||||
.title { |
||||
margin-bottom: 20rpx; |
||||
font-size: 28rpx; |
||||
} |
||||
.credential { |
||||
width: 100%; |
||||
} |
||||
.form-list { |
||||
.name { |
||||
min-width: 250rpx; |
||||
} |
||||
} |
||||
</style> |
@ -1,281 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<view :class="[{'not-auth': !per}]"> |
||||
<view class="filter"> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入方案名称" clearButton="auto" cancelButton="none" v-model="keyword" /> |
||||
</view> |
||||
|
||||
<ul class="tab"> |
||||
<li v-for="(tab, i) in classifications.slice(0, 4)" :class="{active: active === tab.id}" @click="tabChange(tab)">{{ tab.classificationName }}</li> |
||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="typeVisible = true"></uni-icons> |
||||
</ul> |
||||
|
||||
<view v-if="list.length" class="list"> |
||||
<view v-for="(item, i) in list" class="item" @click="toDetail(item)"> |
||||
<view class="c-name ell">{{ item.title }}</view> |
||||
<view class="content"> |
||||
<view class="info"> |
||||
<view class="line"> |
||||
<view class="name">产品:</view> |
||||
<view class="val ell-wrap"> |
||||
<view v-if="!item.toggle" class="product ell">{{ item.productNames }}</view> |
||||
<view v-else class="product" v-html="item.productNamesHtml"></view> |
||||
<view v-if="item.productNames && item.productNames.length > 14" class="toggle" @click.stop="toggle(item)">{{ item.toggle ? '收起' : '展开' }}</view> |
||||
</view> |
||||
</view> |
||||
<view class="line"> |
||||
<view class="name">更新日期:</view> |
||||
<view class="val">{{ item.updateTime }}</view> |
||||
</view> |
||||
<view class="line"> |
||||
<view class="name">适用专业:</view> |
||||
<view class="val">{{ item.applicableMajor }}</view> |
||||
</view> |
||||
</view> |
||||
<!-- <view class="detail" @click.stop="toEmail(i)">下载</view> --> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<empty v-else></empty> |
||||
|
||||
<view :class="['type-popup', {active: typeVisible}]"> |
||||
<uni-icons class="close" type="closeempty" size="20" color="#757575" @click="closeType"></uni-icons> |
||||
<view class="title">所属分类</view> |
||||
<view class="types"> |
||||
<view v-for="(item, i) in classifications" :key="i" :class="['item', {active: active == item.id}]" @click="classificationClick(item)">{{ item.classificationName }}</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<notAuth v-if="!per"></notAuth> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { schemeList, queryClassificationByType } from '@/apis/modules/article.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
per: true, // 是否有权限 |
||||
active: '', |
||||
typeVisible: false, |
||||
classifications: [], |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
articleNameSort: 'desc', |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.per = true |
||||
this.keyword = '' |
||||
this.active = '' |
||||
this.initRole() |
||||
}, |
||||
methods: { |
||||
// 初始化权限 |
||||
initRole() { |
||||
const auth = uni.getStorageSync('auth') |
||||
if (!auth.includes('工作台:方案')) { |
||||
this.per = false |
||||
this.list = [ |
||||
{ |
||||
title: '智信云', |
||||
productNames: '智信云师资培训班', |
||||
applicableMajor: 'python实训系统', |
||||
updateTime: '2023-08-08' |
||||
}, |
||||
{ |
||||
title: '智信云', |
||||
productNames: '智信云师资培训班智信云师资培训班', |
||||
applicableMajor: 'python实训系统', |
||||
updateTime: '2023-08-08' |
||||
}, |
||||
{ |
||||
title: '智信云智信云', |
||||
productNames: '智信云师资培训班智信云师资培训班', |
||||
applicableMajor: 'python实训系统', |
||||
updateTime: '2023-08-08' |
||||
}, |
||||
{ |
||||
title: '智信云', |
||||
productNames: '智信云师资培训班智信云师资培训班', |
||||
applicableMajor: 'python实训系统实训系统', |
||||
updateTime: '2023-08-08' |
||||
}, |
||||
] |
||||
} else { |
||||
this.initList() |
||||
this.getClassification() |
||||
} |
||||
}, |
||||
getList() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
schemeList({ |
||||
keyWord: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
querySource: 4, |
||||
classificationId: this.active |
||||
}).then(({ data }) => { |
||||
uni.hideLoading() |
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
const list = data.records |
||||
list.forEach(e => { |
||||
if (e.productNames) { |
||||
e.toggle = e.productNames.length < 14 // 超过了14个字才需要显示展开按钮 |
||||
e.productNamesHtml = e.productNames.split(',').join('<br>') |
||||
} |
||||
}) |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === data.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// 获取所属分类 |
||||
getClassification() { |
||||
queryClassificationByType(3).then(({ data }) => { |
||||
this.classifications = [ |
||||
{ |
||||
id: '', |
||||
classificationName: '不限' |
||||
} |
||||
] |
||||
this.classifications.push(...data) |
||||
}).catch(e => {}) |
||||
}, |
||||
// 所属分类点击回调 |
||||
classificationClick(item, query) { |
||||
this.active = item.id |
||||
query && this.initList() |
||||
}, |
||||
// 关闭所属分类弹框 |
||||
closeType() { |
||||
this.typeVisible = false |
||||
this.initList() |
||||
}, |
||||
// tab切换 |
||||
tabChange(tab) { |
||||
this.active = tab.id |
||||
this.initList() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`/team/scheme/scheme?id=` + item.id) |
||||
}, |
||||
// 发送邮箱 |
||||
toEmail(id) { |
||||
this.$util.to(`../send/send?id=${id}`) |
||||
}, |
||||
// 展开 |
||||
toggle(item) { |
||||
item.toggle = !item.toggle |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.tab { |
||||
position: relative; |
||||
justify-content: flex-start; |
||||
li { |
||||
padding: 0 30rpx; |
||||
} |
||||
.icon { |
||||
position: absolute; |
||||
top: 32rpx; |
||||
right: 44rpx; |
||||
} |
||||
} |
||||
|
||||
.list { |
||||
background-color: #fff; |
||||
.item { |
||||
padding: 20rpx 40rpx; |
||||
border-bottom: 1px solid #f1f1f1; |
||||
} |
||||
.c-name { |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
.line { |
||||
display: flex; |
||||
padding: 10rpx 0; |
||||
} |
||||
.content { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
margin-top: 20rpx; |
||||
} |
||||
.name { |
||||
width: 140rpx; |
||||
margin-right: 10rpx; |
||||
white-space: nowrap; |
||||
font-size: 28rpx; |
||||
color: #999; |
||||
} |
||||
.val { |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
.product { |
||||
max-width: 67vw; |
||||
white-space: pre-wrap; |
||||
&.ell { |
||||
white-space: nowrap; |
||||
} |
||||
} |
||||
.toggle { |
||||
margin-top: 10rpx; |
||||
white-space: nowrap; |
||||
font-size: 24rpx; |
||||
color: #0e92ef; |
||||
} |
||||
.detail { |
||||
margin-left: 20rpx; |
||||
font-size: 26rpx; |
||||
color: #1f83ff; |
||||
white-space: nowrap; |
||||
} |
||||
} |
||||
</style> |
@ -1,168 +0,0 @@ |
||||
<template> |
||||
<view class="page"> |
||||
<view class="wrap"> |
||||
<view class="inner"> |
||||
<view class="info"> |
||||
<image class="avatar" :src="avatar" mode=""></image> |
||||
<view class="text"> |
||||
<view class="invite"> |
||||
<text class="name">{{ my.info.userName }}</text> 邀请你加入城市合伙人计划 |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="com">{{ team.partnerClassificationName }}</view> |
||||
<u-qrcode v-if="link" class="qrcode" ref="qrcode" canvas-id="qrcode" isQueueLoadImage :size="size" :value="link" @complete="qrcodeComplete"></u-qrcode> |
||||
<image class="qrcode-img" :src="qrcodeImg" show-menu-by-longpress @click="previewImage"></image> |
||||
|
||||
<view class="tips" style="margin-top: 20rpx;">扫一扫,加入我们吧</view> |
||||
<view class="tips">长按可转发至微信好友和保存图片</view> |
||||
</view> |
||||
<view class="warn">邀请二维码失效日期:{{ expireTime }}</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { generateInvitationCode, my } from '@/apis/modules/parner.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png', |
||||
my: { |
||||
info: {}, |
||||
}, |
||||
expireTime: '', |
||||
qrcode: '', |
||||
link: '', |
||||
qrcodeImg: '', |
||||
size: uni.upx2px(420), |
||||
team: uni.getStorageSync('team') |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.getInfo() |
||||
}, |
||||
methods: { |
||||
// 获取个人信息 |
||||
getInfo() { |
||||
const team = uni.getStorageSync('team') |
||||
my({ |
||||
partnerId: team.partnerId, |
||||
teamId: team.teamId |
||||
}).then(({ my }) => { |
||||
this.my = my |
||||
this.$nextTick(() => { |
||||
this.getQrcode() |
||||
}) |
||||
}).catch(e => {}) |
||||
}, |
||||
// 生成二维码 |
||||
getQrcode() { |
||||
const { team } = this |
||||
// 生成邀请码 |
||||
generateInvitationCode(uni.getStorageSync('team').accountId).then(({ expireTime }) => { |
||||
const date = new Date(Date.now() + expireTime * 1000) // 返回的秒,要*1000 |
||||
this.expireTime = `${date.getFullYear()}-${this.$util.preZero(date.getMonth() + 1)}-${this.$util.preZero(date.getDate())} ${this.$util.preZero(date.getHours())}:${this.$util.preZero(date.getMinutes())}:${this.$util.preZero(date.getMinutes())}` |
||||
this.link = `https://www.occupationlab.com/#/join?accountId=${team.accountId}&id=${team.teamId}&isTeam=0&teamName=${this.my.info.userName}&provinceId=${uni.getStorageSync('provinceId')}&cityId=${uni.getStorageSync('cityId')}` |
||||
// this.link = `http://121.37.12.51/backstage/#/join?accountId=${team.accountId}&id=${team.teamId}&isTeam=0&teamName=${this.my.info.userName}&provinceId=${uni.getStorageSync('provinceId')}&cityId=${uni.getStorageSync('cityId')}` |
||||
}).catch(e => {}) |
||||
}, |
||||
// 二维码组件生成完成钩子。生成后把图片导出给image组件,image组件才可以长按二维码转发 |
||||
qrcodeComplete() { |
||||
console.log('complete', this.$refs.qrcode.toTempFilePath, this.link) |
||||
this.$refs.qrcode.toTempFilePath({ |
||||
success: res => { |
||||
this.qrcodeImg = res.tempFilePath |
||||
}, |
||||
fail: res => { |
||||
console.log('fail', res) |
||||
} |
||||
}); |
||||
}, |
||||
previewImage(e){ |
||||
uni.previewImage({ |
||||
// 需要预览的图片链接列表。若无需预览,可以注释urls |
||||
urls: [e.target.src], |
||||
// 为当前显示图片的链接/索引值 |
||||
current: e.target.src, |
||||
// 图片指示器样式 |
||||
indicator:'default', |
||||
// 是否可循环预览 |
||||
loop:false, |
||||
// 长按图片显示操作菜单,如不填默认为保存相册 |
||||
// longPressActions:{ |
||||
// itemList:[this.l('发送给朋友'),this.l] |
||||
// }, |
||||
success: res => { |
||||
console.log('previewImage res', res); |
||||
}, |
||||
fail: err => {} |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
height: 100%; |
||||
overflow: hidden; |
||||
} |
||||
.wrap { |
||||
padding-bottom: 40rpx; |
||||
text-align: center; |
||||
background-color: #fff; |
||||
.inner { |
||||
position: relative; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
align-items: center; |
||||
padding: 40rpx 80rpx 0; |
||||
} |
||||
.info { |
||||
display: flex; |
||||
align-items: center; |
||||
margin-bottom: 40rpx; |
||||
text-align: left; |
||||
} |
||||
.avatar { |
||||
width: 80rpx; |
||||
height: 80rpx; |
||||
margin-right: 20rpx; |
||||
border-radius: 50%; |
||||
} |
||||
.invite { |
||||
font-size: 26rpx; |
||||
} |
||||
.name { |
||||
margin-right: 5rpx; |
||||
font-size: 30rpx; |
||||
color: $uni-primary; |
||||
} |
||||
.com { |
||||
margin: 20rpx 0; |
||||
font-size: 30rpx; |
||||
} |
||||
.qrcode { |
||||
display: none; |
||||
} |
||||
.qrcode-img { |
||||
width: 420rpx; |
||||
height: 420rpx; |
||||
} |
||||
.tips { |
||||
margin-bottom: 10rpx; |
||||
font-size: 24rpx; |
||||
color: #333; |
||||
} |
||||
.warn { |
||||
margin-top: 10rpx; |
||||
font-size: 24rpx; |
||||
color: #f00; |
||||
} |
||||
} |
||||
</style> |
@ -1,116 +0,0 @@ |
||||
<template> |
||||
<view class="wrap"> |
||||
<view class="title">{{ form.title }}</view> |
||||
|
||||
<view class="text">{{ form.applicableMajor }}</view> |
||||
<view class="text">{{ form.schemeIntroduction }}</view> |
||||
<view class="text" v-html="form.product"></view> |
||||
<template v-if="form.fileName"> |
||||
<view class="file">{{ form.fileName }}</view> |
||||
<view class="detail" @click.stop="download">下载</view> |
||||
</template> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { schemeFindById } from '@/apis/modules/article.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
id: '', |
||||
form: { |
||||
totalBrowsing: '' |
||||
} |
||||
} |
||||
}, |
||||
onShow() { |
||||
const pages = getCurrentPages() |
||||
const { options } = pages[pages.length - 1] |
||||
this.id = options.id |
||||
this.getInfo() |
||||
}, |
||||
methods: { |
||||
// 获取详情 |
||||
getInfo() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
schemeFindById(this.id).then(({ data }) => { |
||||
if (data.productList) data.product = data.productList.map(e => e.productName).join('<br>') |
||||
this.form = data |
||||
uni.hideLoading() |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
// 下载方案文件 |
||||
download() { |
||||
uni.setStorageSync('files', { |
||||
copyWriting: this.form.title, |
||||
fileName: [this.form.fileName], |
||||
urls: [this.form.schemeFile] |
||||
}) |
||||
this.$util.to(`/team/send/send`) |
||||
// uni.showLoading({ |
||||
// title: '加载中', |
||||
// mask: true |
||||
// }) |
||||
// const url = this.form.schemeFile |
||||
// const that = this |
||||
// // 下载文件资源到本地 |
||||
// uni.downloadFile({ |
||||
// url, |
||||
// success: function(res) { |
||||
// console.log(444, res) |
||||
// uni.saveFile({ |
||||
// tempFilePath: res.tempFilePath, |
||||
// success: function(res) { |
||||
// console.log(555, res) |
||||
// // 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。 |
||||
// that.$util.isDoc(url.substring(url.lastIndexOf('.') +1)) && uni.openDocument({ |
||||
// filePath: res.savedFilePath, |
||||
// showMenu: true, // 允许出现分享功能 |
||||
// success: res => { |
||||
// uni.hideLoading() |
||||
// }, |
||||
// fail: openError => { |
||||
// uni.hideLoading() |
||||
// } |
||||
// }) |
||||
// } |
||||
// }) |
||||
// }, |
||||
// fail: function(err) { |
||||
// uni.hideLoading() |
||||
// } |
||||
// }) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.wrap { |
||||
padding: 30rpx; |
||||
background-color: #fff; |
||||
} |
||||
.title { |
||||
font-size: 34rpx; |
||||
font-weight: 600; |
||||
color: #333; |
||||
} |
||||
.text { |
||||
margin: 20rpx 0; |
||||
font-size: 28rpx; |
||||
line-height: 1.6; |
||||
} |
||||
.file { |
||||
margin: 20rpx 0; |
||||
font-size: 26rpx; |
||||
word-break: break-all; |
||||
} |
||||
.detail { |
||||
font-size: 30rpx; |
||||
color: #1f83ff; |
||||
} |
||||
</style> |
@ -1,92 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<uni-list> |
||||
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="phoneIcon" title="手机号" :rightText="info.phone" clickable @click="toPage('../phone/phone')" /> |
||||
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="mailIcon" title="邮箱" :rightText="info.email" clickable @click="toPage('../email/email')" /> |
||||
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="accountIcon" title="账号" :rightText="info.account" clickable @click="toPage('../account/account')" /> |
||||
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="pwdIcon" title="密码" rightText="******" clickable @click="toPage('../password/password')" /> |
||||
</uni-list> |
||||
|
||||
<view class="logout" @click="logout">退出登录</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { my } from '@/apis/modules/parner.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
phoneIcon: { |
||||
color: '#007eff', |
||||
size: '22', |
||||
type: 'phone' |
||||
}, |
||||
mailIcon: { |
||||
color: '#007eff', |
||||
size: '22', |
||||
type: 'email' |
||||
}, |
||||
accountIcon: { |
||||
color: '#007eff', |
||||
size: '22', |
||||
type: 'person' |
||||
}, |
||||
pwdIcon: { |
||||
color: '#007eff', |
||||
size: '22', |
||||
type: 'locked' |
||||
}, |
||||
info: { |
||||
account: '', |
||||
phone: '', |
||||
email: '' |
||||
}, |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.getInfo() |
||||
}, |
||||
methods: { |
||||
// 获取个人信息 |
||||
getInfo() { |
||||
const { partnerId, teamId } = uni.getStorageSync('team') |
||||
my({ |
||||
partnerId, |
||||
teamId |
||||
}).then(({ my }) => { |
||||
this.info = my.info |
||||
}).catch(e => {}) |
||||
}, |
||||
toPage(path) { |
||||
this.$util.to(path) |
||||
}, |
||||
// 退出登录 |
||||
logout() { |
||||
const that = this |
||||
uni.showModal({ |
||||
title: '提示', |
||||
content: '确定要退出账号吗?', |
||||
success(res) { |
||||
if (res.confirm) { |
||||
uni.clearStorageSync() |
||||
uni.reLaunch({ |
||||
url: '/pages/index/index' |
||||
}) |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.logout { |
||||
padding: 30rpx 0; |
||||
margin-top: 30rpx; |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
text-align: center; |
||||
background-color: #fff; |
||||
} |
||||
</style> |
@ -1,289 +0,0 @@ |
||||
<template> |
||||
<view> |
||||
<view class="search-wrap"> |
||||
<image class="bg" src="@/static/image/study-bg.jpg"></image> |
||||
<view class="info"> |
||||
<view class="text">销售必备技能</view> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入文章名称,标签" v-model="keyword" clearButton="auto" cancelButton="none" bgColor="#fff" /> |
||||
</view> |
||||
</view> |
||||
|
||||
<view class="type"> |
||||
<view v-for="(item, i) in classifications.slice(0, 4)" :key="i" :class="['item', {active: active == item.id}]" @click="classificationClick(item, 1)">{{ item.classificationName }}</view> |
||||
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="typeVisible = true"></uni-icons> |
||||
</view> |
||||
|
||||
<template v-if="list.length"> |
||||
<view class="list"> |
||||
<view v-for="(item, i) in list" :key="i" class="item" @click="toDetail(item)"> |
||||
<image class="pic" :src="item.bannerImg"></image> |
||||
<view class="right"> |
||||
<view class="title ell">{{ item.title }}</view> |
||||
<view v-if="item.labelName" class="labels"> |
||||
<view v-for="(label, j) in item.labelName.split(',').slice(0, 2)" :key="j" class="label">{{ label }}</view> |
||||
</view> |
||||
<view class="metas"> |
||||
<view class="meta"> |
||||
<uni-icons class="icon" type="eye" size="22" color="#007FFF"></uni-icons> |
||||
{{ item.learnerNumber }}人学过 |
||||
</view> |
||||
<view class="meta" @click.stop="collect(item)"> |
||||
<uni-icons class="icon" :type="item.collectionStatus ? 'star-filled' : 'star'" size="22" color="#007eff"></uni-icons> |
||||
{{ item.collectionNumber }} |
||||
</view> |
||||
</view> |
||||
<view v-if="item.lastReading" class="last">上次阅读</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<uni-load-more :status="status" /> |
||||
</template> |
||||
<empty v-else></empty> |
||||
|
||||
<view :class="['type-popup', {active: typeVisible}]"> |
||||
<uni-icons class="close" type="closeempty" size="20" color="#757575" @click="closeType"></uni-icons> |
||||
<view class="title">所属分类</view> |
||||
<view class="types"> |
||||
<view v-for="(item, i) in classifications" :key="i" :class="['item', {active: active == item.id}]" @click="classificationClick(item)">{{ item.classificationName }}</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { partnerOperatingList, queryClassificationByType, collectCourse } from '@/apis/modules/article.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
classifications: [], |
||||
active: '', |
||||
typeVisible: false, |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
articleNameSort: '', |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.keyword = '' |
||||
this.active = '' |
||||
this.typeVisible = false |
||||
this.initRole() |
||||
}, |
||||
methods: { |
||||
// 初始化权限 |
||||
initRole() { |
||||
if (!uni.getStorageSync('auth').includes('学习')) { |
||||
this.per = false |
||||
} |
||||
this.initList() |
||||
this.getClassification() |
||||
}, |
||||
getList() { |
||||
const data = { |
||||
keyWord: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
querySource: 4, |
||||
typeId: 1, |
||||
articleNameSort: this.articleNameSort, |
||||
classificationId: this.active |
||||
} |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
partnerOperatingList(data).then(({ page, total }) => { |
||||
uni.hideLoading() |
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
const list = page |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// 获取所属分类 |
||||
getClassification() { |
||||
queryClassificationByType(1).then(({ data }) => { |
||||
this.classifications = [ |
||||
{ |
||||
id: '', |
||||
classificationName: '不限' |
||||
} |
||||
] |
||||
this.classifications.push(...data) |
||||
}).catch(e => {}) |
||||
}, |
||||
// 所属分类点击回调 |
||||
classificationClick(item, query) { |
||||
this.active = item.id |
||||
query && this.initList() |
||||
}, |
||||
// 关闭所属分类弹框 |
||||
closeType() { |
||||
this.typeVisible = false |
||||
this.initList() |
||||
}, |
||||
// 展开 |
||||
toggle(item) { |
||||
item.toggle = !item.toggle |
||||
}, |
||||
// 排序 |
||||
switchSort() { |
||||
this.articleNameSort = this.articleNameSort === 'desc' ? 'asc' : 'desc' |
||||
this.initList() |
||||
}, |
||||
// 收藏 |
||||
collect(item) { |
||||
const state = item.collectionStatus ? 0 : 1 |
||||
collectCourse(item.id, state).then(({ data }) => { |
||||
item.collectionStatus = state |
||||
state ? ++item.collectionNumber : --item.collectionNumber |
||||
}).catch(e => {}) |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`/team/article/article?id=` + item.id) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.search-wrap { |
||||
position: relative; |
||||
height: 300rpx; |
||||
padding: 120rpx 10px 0; |
||||
.bg { |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
.info { |
||||
position: relative; |
||||
} |
||||
.text { |
||||
margin: 0 10px 10rpx; |
||||
font-size: 50rpx; |
||||
color: #fff; |
||||
} |
||||
} |
||||
.type { |
||||
position: relative; |
||||
display: flex; |
||||
padding: 30rpx; |
||||
background-color: #fff; |
||||
.item { |
||||
padding: 0 15rpx; |
||||
line-height: 1.6; |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
white-space: nowrap; |
||||
&.active { |
||||
color: #007FFF; |
||||
font-weight: 600; |
||||
} |
||||
} |
||||
.icon { |
||||
position: absolute; |
||||
right: 40rpx; |
||||
width: 40rpx; |
||||
} |
||||
} |
||||
.list { |
||||
background-color: #fff; |
||||
.item { |
||||
position: relative; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
margin-bottom: 10rpx; |
||||
padding: 20rpx 40rpx; |
||||
border-bottom: 1px solid #f1f1f1; |
||||
} |
||||
.pic { |
||||
width: 260rpx; |
||||
height: 180rpx; |
||||
border-radius: 8px; |
||||
} |
||||
.right { |
||||
width: calc(100% - 280rpx); |
||||
} |
||||
.title { |
||||
margin-bottom: 15rpx; |
||||
font-size: 32rpx; |
||||
font-weight: 600; |
||||
color: #333; |
||||
} |
||||
.labels { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
align-items: center; |
||||
} |
||||
.label { |
||||
padding: 2px 6px; |
||||
margin: 0 20rpx 15rpx 0; |
||||
font-size: 24rpx; |
||||
color: #fff; |
||||
background-color: #ccc; |
||||
border-radius: 4px; |
||||
} |
||||
.metas { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
.meta { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
margin-right: 20rpx; |
||||
font-size: 24rpx; |
||||
} |
||||
.icon { |
||||
margin-right: 5rpx; |
||||
} |
||||
.last { |
||||
position: absolute; |
||||
bottom: 20rpx; |
||||
right: 40rpx; |
||||
font-size: 28rpx; |
||||
color: #007FFF; |
||||
} |
||||
} |
||||
</style> |