购物车、产品详情等

master
yujialong 1 year ago
parent 61114ba893
commit 8d2d820c40
  1. 4
      apis/modules/order.js
  2. 16
      apis/modules/product.js
  3. 4
      config/request.js
  4. 82
      order/addCourse/addCourse.vue
  5. 10
      order/editCourse/editCourse.vue
  6. 12
      order/orderDetail/orderDetail.vue
  7. 43
      order/productDetail/productDetail.vue
  8. 195
      order/products/products.vue
  9. 183
      order/shopCart/shopCart.vue
  10. 9
      pages.json
  11. 91
      pages/index/index.vue
  12. 3
      pages/workbench/workbench.vue
  13. BIN
      static/image/product/shop-blue.png
  14. BIN
      static/image/product/shop.png
  15. 30
      styles/common.scss

@ -36,3 +36,7 @@ export const del = (data) => {
export const miniProgramOrderRecord = (data) => {
return post('nakadai/nakadai/applets/order/miniProgramOrderRecord', data)
}
export const queryCitySettlementPrice = (mallId, provinceId, cityId) => {
return post(`nakadai/mallPrice/queryCitySettlementPrice?mallId=${mallId}&provinceId=${provinceId}&cityId=${cityId}`)
}

@ -20,3 +20,19 @@ export const detailsOfGoods = (id) => {
export const productCategoryList = () => {
return get('nakadai/productClassification/productCategoryList')
}
export const productTypeList = () => {
return get('nakadai/productType/productTypeList')
}
export const addToShoppingCart = (data) => {
return post('nakadai/mini/program/shopping/cart/addToShoppingCart', data)
}
export const delCart = (data) => {
return post('nakadai/mini/program/shopping/cart/batchDeletion', data)
}
export const shoppingCartList = (data) => {
return post('nakadai/mini/program/shopping/cart/shoppingCartList', data)
}

@ -5,8 +5,8 @@
*/
export default {
baseURL: 'https://huorantech.cn/',
// baseURL: 'http://192.168.31.151:9000/',
// baseURL: 'https://huorantech.cn/',
baseURL: 'http://192.168.31.51:9000/',
// baseURL: 'http://121.37.12.51/',
headers: {
'Content-Type': 'application/json;charset=UTF-8'

@ -11,7 +11,7 @@
</ul>
<ul class="list">
<li v-for="(item, i) in 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)" mode="widthFix"></image>
@ -29,12 +29,15 @@
<script>
import { productCategoryList, listOfGoods } from '@/apis/modules/product.js'
import { renew } from '@/apis/modules/order.js'
import { renew, queryCitySettlementPrice } from '@/apis/modules/order.js'
export default {
data() {
return {
// authority: 01234
orderType: 1,
customerId: '',
provinceId: '',
cityId: '',
curTab: '',
tabs: [
{
@ -96,6 +99,8 @@
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()
},
@ -201,7 +206,7 @@
})
},
//
createParam(e) {
createParam(e, authority) {
const { orderType } = this
const trial = orderType == 2 //
return {
@ -217,16 +222,16 @@
finalPrice: trial ? 0 : '', //
finalValue: trial ? 0 : '', //
discountRate: trial ? '0%' : '', //
accountNum: '', //
accountNum: authority ? 1 : '', //
totalAmount: '', //
isEnable: 0, // 10
ship: 0, // 01
authority: e.productType === 2 ? 0 : 1, // 01
authority, // 01
options: 2,
miniProgramPictureAddress: e.appletIcon, //
settlementPrice: trial ? 0 : '', //
settlementMethod: e.settlementMethod, // 01
settlementPriceUnit: e.settlementPrice, //
settlementPriceUnit: e.settlementPrice || 0, //
serviceFee: 0 //
}
},
@ -255,23 +260,65 @@
const list = this.checked //
if (list.length) {
const result = this.courses
const courseIds = []
const dataIds = []
const list1 = [] //
const list0 = [] //
const list2 = [] //
const list3 = [] //
const list4 = [] //
const { customerId } = this
list.map(e => {
// id
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)) {
e.productType === 2 ? dataIds.push(e.id) : courseIds.push(e.id)
result.push(this.createParam(e))
let authority
//
const res = await queryCitySettlementPrice(e.mallId, this.provinceId, this.cityId)
if (res.mallPrice) e.settlementPrice = res.mallPrice.discountRate
console.log(44, e)
const classId = e.classificationId
const pid = +e.associatedProduct
if (classId == 1 || classId == 2) {
authority = 1
list1.push(pid)
} else if (classId == 3) {
authority = 2
list2.push(pid)
} else if (classId == 4) {
authority = 3
list3.push(pid)
} else if (classId == 5) {
authority = 0
list0.push(pid)
} else if (classId == 6) {
authority = 4
list4.push(pid)
}
result.push(this.createParam(e, authority))
resolve()
} else {
resolve()
}
}))
})
Promise.all(listPromise).then(_ => {
const promises = []
//
dataIds.length && promises.push(new Promise((resolve, reject) => {
this.handleRenew(0, customerId, dataIds, result, resolve, reject)
// 5authorityrenew
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)
}))
courseIds.length && promises.push(new Promise((resolve, reject) => {
this.handleRenew(1, customerId, courseIds, 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(_ => {
uni.setStorageSync('courses', result) //
@ -279,6 +326,7 @@
url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}`
})
})
})
} else {
this.$util.errMsg('请选择产品!')
}

@ -253,7 +253,7 @@
//
dealSettlePrice(row) {
// 0
console.log('row=>', row)
console.log('dealSettlePrice=>', row, this.orderType)
if (this.orderType == 2) {
row.settlementPrice = 0
row.serviceFee = 0
@ -261,7 +261,6 @@
const unit = row.options // 使
const useUnit = row.periodOfUse // 使
let sPrice = ''
if (row.settlementMethod == 0) {
// **/**(1)
const priceUnit = row.settlementPriceUnit
sPrice = ((!unit ?
@ -271,12 +270,9 @@
priceUnit * useUnit) * (row.authority ?
1 :
row.accountNum)).toFixed((2))
} else {
// *
sPrice = (row.finalPrice * row.businessProportion / 100).toFixed((2))
}
console.log('dealSettlePrice2=>', row, this.orderType, this.$util.handleNaN(sPrice))
row.settlementPrice = this.$util.handleNaN(sPrice)
// *10%
//
if (row.settlementPrice) {
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2)
}

@ -366,7 +366,7 @@
uni.setStorageSync('courses', this.courses)
const { customerId, orderType } = this.form
customerId ?
this.$util.to(`../addCourse/addCourse?orderType=${orderType}&customerId=${customerId}`) :
this.$util.to(`../addCourse/addCourse?orderType=${orderType}&customerId=${customerId}&provinceId=${this.form.provinceId}&cityId=${this.form.cityId}`) :
this.$util.errMsg('请先选择客户!')
},
//
@ -459,21 +459,15 @@
} else {
const unit = row.options // 使
const useUnit = row.periodOfUse // 使
let sPrice = ''
if (row.settlementMethod == 0) {
// **/**(1)
const priceUnit = row.settlementPriceUnit
sPrice = ((!unit ?
let sPrice = ((!unit ?
priceUnit / 365 * useUnit :
unit === 1 ?
priceUnit / 12 * useUnit :
priceUnit * useUnit) * (row.authority ?
1 :
row.accountNum)).toFixed((2))
} else {
// *
sPrice = (row.finalPrice * row.businessProportion / 100).toFixed((2))
}
row.settlementPrice = this.$util.handleNaN(sPrice)
// *10%
if (row.settlementPrice) {
@ -511,7 +505,7 @@
//
publicNotice() {
uni.requestSubscribeMessage({
tmplIds: ['8pDVfWYqh9c-nn3CeA1NXM58pmoyQXZzkVnRFKy_l2A'],
tmplIds: ['8pDVfWYqh9c-nn3CeA1NXJtBxdd1FYiCtrl5BeLvbgU'],
success: (res) => {
uni.navigateBack()
},

@ -81,19 +81,21 @@
<image class="icon" src="@/static/image/product/ppt.png"></image>
{{ file.fileName }}
</view>
<view class="download">下载</view>
<view class="download" @click="download(file)">下载</view>
</view>
</view>
</view>
<view class="footer">
<view class="shop">
<view class="shop" @click="$util.to('../shopCart/shopCart')">
<uni-badge size="small" :text="shopCartTotal" absolute="topRight" type="error">
<image class="icon" src="@/static/image/product/shop.png" mode="widthFix"></image>
</uni-badge>
<view>购物车</view>
</view>
<view class="btns">
<view class="btn">加入购物车</view>
<view class="btn" @click="addShop">加入购物车</view>
<view class="btn order">下单</view>
</view>
</view>
@ -101,7 +103,7 @@
</template>
<script>
import { detailsOfGoods } from '@/apis/modules/product.js'
import { detailsOfGoods, addToShoppingCart, shoppingCartList } from '@/apis/modules/product.js'
export default {
data() {
return {
@ -129,6 +131,7 @@
goodsRes: {},
mallAnnex: []
},
shopCartTotal: 0
}
},
onShow() {
@ -136,6 +139,7 @@
const { options } = pages[pages.length - 1]
this.id = options.id
this.getInfo()
this.getShopCart()
},
methods: {
//
@ -150,14 +154,38 @@
uni.hideLoading()
})
},
//
getShopCart() {
shoppingCartList({
pageNum: 1,
pageSize: 1000,
}).then(({ data }) => {
this.shopCartTotal = data.total
}).catch(e => {})
},
// tab
tabChange(tab) {
this.curTab = tab.id
},
//
download(item) {
this.$util.to(`../send/send?url=${item.filePath}&copyWriting=${item.fileName}`)
this.$util.to(`/team/send/send?url=${item.filePath}&copyWriting=${item.fileName}`)
},
//
addShop() {
uni.showLoading({
title: '加载中'
})
addToShoppingCart({
mallId: this.id
}).then(res => {
this.$util.sucMsg('加购成功')
uni.hideLoading()
this.getShopCart()
}).catch(e => {
uni.hideLoading()
})
}
}
}
</script>
@ -316,11 +344,12 @@
background-color: #fff;
box-sizing: border-box;
.shop {
text-align: center;
font-size: 24rpx;
color: #333;
.icon {
width: 56rpx;
}
font-size: 24rpx;
color: #333;
}
.btns {
display: inline-flex;

@ -2,15 +2,17 @@
<view>
<view class="filter">
<uni-search-bar class="search" radius="30" placeholder="请输入产品名称" v-model="keyword" clearButton="auto" cancelButton="none" />
<view :class="['sort', sort]" @click="switchSort"></view>
<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>
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">
{{ tab.name }}
<view v-if="i == 2" :class="['sort', {desc: sort == 2, asc: sort == 5}]"></view>
</li>
</ul>
<ul class="list">
<li v-for="item in list">
<li v-for="(item, i) in list" :key="i" @click="toDetail(item)">
<view class="pro-name">
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image>
{{ item.productName }}
@ -39,40 +41,58 @@
</li>
</ul>
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('/order/orderDetail/orderDetail')"></uni-icons>
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
<view 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 :data="filters" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
</view>
</template>
<script>
import { tagsList, listOfGoods } from '@/apis/modules/product.js'
import { queryCustomer } from '@/apis/modules/client.js'
import { list, del } from '@/apis/modules/order.js'
import { tagsList, listOfGoods, productTypeList } from '@/apis/modules/product.js'
export default {
data() {
return {
popup: false,
//
filterData: [
filters: [
{
children: false,//
title: "订单状态",
key: "orderStatus", //
title: "产品类型",
key: "productType", //
keyValue: "value", //
isRadio: true, //
data: [],
},
{
children: false,//
title: "官方精选",
key: "selection", //
keyValue: "value", //
data: [
{
title: "待发货",
value: 0
value: 1,
title: '官方精选'
}
],
},
{
title: "已完成",
value: 1
children: false,//
title: "产品标签",
key: "tagId", //
keyValue: "value", //
isRadio: true, //
data: [],
},
],
}
],
filterForm: {},
productType: '',
selection: '',
hotTag: 1,
tagId: '',
curTab: 0,
tabs: [
{
@ -85,24 +105,19 @@
},
{
name: '发布时间',
id: 1
id: 2
}
],
reachBottom: 0, // 0->,1->,-1->
status: 'more', // more|loading|noMore
searchTimer: null,
orderStatus: '',
sort: 'desc',
sort: 2,
keyword: '',
list: [],
page: 1,
pageSize: 10,
delOption: [{
text: '删除',
style: {
backgroundColor: '#F56C6C'
}
}],
total: 0,
cartNum: ''
}
},
watch: {
@ -129,17 +144,25 @@
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.tagId = +options.tagId || ''
this.page = 1
this.getList()
this.getFilter()
},
methods: {
getList() {
listOfGoods({
pageNum: this.page,
pageSize: this.pageSize,
sort: 0,
sort: this.curTab == 2 ? this.sort : this.curTab,
isShelves: 0,
hotTag: 1,
hotTag: this.tagId ? 2 : 1,
tagId: this.tagId,
productName: this.keyword,
productType: this.productType,
selection: this.selection
}).then(({ page }) => {
// list
const list = page.records
@ -148,6 +171,7 @@
})
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list
this.page++ // page+1
this.total = page.total
const noMore = this.list.length === page.total //
this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1
@ -158,107 +182,118 @@
this.reachBottom = 0
this.getList()
},
//
getFilter() {
//
productTypeList().then(res => {
res.typeList.forEach(e => {
e.value = e.typeId
e.title = e.typeName
})
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 => {})
},
//
toggle(item) {
item.toggle = !item.toggle
},
//
subFinsh(val) {
const { orderStatus } = val
this.orderStatus = orderStatus.length ? orderStatus[0] : ''
this.initList()
},
//
switchSort() {
this.sort = this.sort === 'desc' ? 'asc' : 'desc'
const { productType, selection, tagId } = val
this.productType = productType.length ? productType[0] : ''
this.selection = selection.length ? selection[0] : ''
this.tagId = tagId.length ? tagId[0] : ''
this.initList()
},
// tab
tabChange(tab) {
this.curTab = tab.id
tabChange({ id }) {
this.sort = id == 2 ?
this.sort == 2 ? 5 : 2
: ''
this.curTab = id
this.initList()
},
//
toDetail(item) {
this.$util.to(`/order/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.initList()
}).catch(res => {})
}
}
})
console.log(44, item)
this.$util.to(`../productDetail/productDetail?id=${item.mallId}`)
},
}
}
</script>
<style scoped lang="scss">
.tab {
li {
display: inline-flex;
align-items: center;
}
}
.list {
margin-top: 20rpx;
li {
padding: 0 24rpx;
margin: 16rpx 24rpx;
background-color: #fff;
.item {
padding: 20rpx 40rpx;
border-bottom: 1px solid #f1f1f1;
border-radius: 16rpx;
}
.c-name {
.pro-name {
display: flex;
align-items: center;
padding: 18rpx 0;
font-size: 30rpx;
color: #333;
border-bottom: 1px solid #E6E8ED;
.icon {
width: 52rpx;
height: 52rpx;
margin-right: 20rpx;
}
.info {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10rpx;
}
.left {
max-width: 70%;
.info {
padding: 12rpx 0;
}
.line {
display: flex;
padding: 10rpx 0;
padding: 12rpx 0;
}
.name {
margin-right: 10rpx;
white-space: nowrap;
font-size: 28rpx;
color: #999;
}
.val {
max-width: 88%;
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-top: 10rpx;
margin-left: 10rpx;
white-space: nowrap;
font-size: 24rpx;
color: #0e92ef;
}
.type {
margin-left: 20rpx;
font-size: 28rpx;
color: #ff7b2d;
white-space: nowrap;
}
.type1 {
color: #bdbdbd;
}
.plus {
.icon {
width: 80rpx;
}
}
</style>

@ -0,0 +1,183 @@
<template>
<view class="page">
<ul class="list">
<li v-for="(item, i) in list">
<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)" mode="widthFix"></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">生成订单</view>
</view>
</view>
</template>
<script>
import { shoppingCartList, delCart } 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: [], //
}
},
//
onPullDownRefresh() {
this.initList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
//
onReachBottom() {
if (this.reachBottom >= 0) {
this.reachBottom = 1
this.status = 'loading'
this.getList()
}
},
onShow() {
this.getList()
},
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 //
const { checked } = this //
//
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)
// pushpush
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 { list } = this
this.checked = isCheck ? list.map(e => e.id) : []
list.forEach(e => {
e.check = isCheck ? 1 : 0
})
},
//
submit() {
const list = this.checked //
if (list.length) {
} else {
this.$util.errMsg('请选择产品!')
}
}
}
}
</script>
<style scoped lang="scss">
.page {
padding-bottom: 130rpx;
}
.list {
li {
display: flex;
align-items: center;
padding: 30rpx 24rpx;
margin: 16rpx 24rpx;
font-size: 30rpx;
color: #333;
background-color: #fff;
border-radius: 16rpx;
}
.icon {
width: 80rpx;
margin: 0 20rpx;
}
}
/deep/.check {
.checklist-box {
margin: 0 !important;
}
.checkbox__inner {
width: 40rpx !important;
height: 40rpx !important;
border-radius: 50% !important;
}
.checkbox__inner-icon {
top: 8rpx !important;
left: 14rpx !important;
}
}
.btn-wrap {
position: fixed;
justify-content: space-between;
.btn {
width: 340rpx;
margin-left: 27rpx;
}
}
</style>

@ -142,6 +142,15 @@
"enablePullDownRefresh": true
}
}
,{
"path" : "shopCart/shopCart",
"style" :
{
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": false
}
}
]
},

@ -16,7 +16,7 @@
</view>
<ul class="tags">
<li v-for="(tag, i) in tags" :key="i" @click="$util.to('/order/productDetail/productDetail?id=' + item.mallId)">
<li v-for="(tag, i) in tags" :key="i" @click="toHot(tag)">
<image class="icon" :src="require('@/static/image/index/' + (i + 1) + '.png')"></image>
<view class="text ell">{{ tag.tagsName }}</view>
</li>
@ -27,7 +27,7 @@
<view class="block">
<view class="title-wrap">
<view class="title">热销产品</view>
<view class="all">全部产品</view>
<view class="all" @click="toProduct">全部产品</view>
</view>
<view class="list">
<view v-for="(item, i) in hotProducts" :key="i" class="item" @click="toDetail(item)">
@ -49,7 +49,7 @@
<view class="block">
<view class="title-wrap">
<view class="title">官方推荐</view>
<view class="all">全部产品</view>
<view class="all" @click="toProduct">全部产品</view>
</view>
<view class="list">
<view v-for="(item, i) in offcialProducts" :key="i" class="item" @click="toDetail(item)">
@ -72,12 +72,15 @@
</template>
<script>
import { getUserRolesPermissionMenu } from '@/apis/modules/user.js'
import { tagsList, listOfGoods } from '@/apis/modules/product.js'
import { getTeamsByAccountId } from '@/apis/modules/client.js'
export default {
data() {
return {
per: true, //
teamId: uni.getStorageSync('teamId') || '',
list: [],
keyword: '',
tags: [],
hotProducts: [],
@ -94,8 +97,7 @@
},
onShow() {
this.per = true
this.getTags()
this.getProducts()
this.getInfo()
},
methods: {
//
@ -103,9 +105,72 @@
if (!uni.getStorageSync('auth').includes('首页')) {
this.per = false
}
this.getStudy()
this.getSell()
this.getAnalysis()
this.getTags()
this.getProducts()
},
//
getAuth() {
uni.getStorageSync('token') && getUserRolesPermissionMenu({
teamId: this.list.find(e => e.teamId == this.teamId).partnerClassificationId,
platformId: 4
}).then(({ permissionMenu }) => {
uni.hideLoading()
const auth = []
//
const generateAuth = (list, parent) => {
list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}`
auth.push(name)
generateAuth(e.children, name)
})
}
generateAuth(permissionMenu[0].children, '')
uni.setStorageSync('auth', auth)
this.$forceUpdate()
this.initRole()
}).catch(e => {
uni.hideLoading()
uni.setStorageSync('auth', [])
this.initRole()
})
},
//
getInfo() {
uni.showLoading({
title: '加载中'
})
getTeamsByAccountId().then(({ data }) => {
data.map(e => {
const n = e.partnerClassificationList
e.id = n.id
// parnerIdidteamIduni.getStorageSync('team').partnerId使
e.teamId = e.isTeam == 1 ? +e.partnerClassificationId : n.id
e.partnerClassificationName = n.partnerClassificationName
delete e.partnerClassificationList
})
if (data.length) {
/**
* @description 如果是第一次进则默认选中第一个团队并把该团队的信息存入缓存
* 或者团队列表里没有该id则说明超管已经被转让也需要重新选中团队
*/
if (!uni.getStorageSync('team') || !data.find(e => e.teamId == this.teamId)) {
this.teamId = data[0].teamId
uni.setStorageSync('team', data[0])
}
} else {
// 退
uni.hideLoading()
uni.clearStorageSync()
uni.navigateTo({
url: '../login/login'
})
}
this.list = data
this.getAuth()
}).catch(e => {
uni.hideLoading()
})
},
//
getTags() {
@ -138,11 +203,13 @@
this.offcialProducts = page.records
}).catch(e => {})
},
//
toHot(item) {
this.$util.to(`/order/products/products?tagId=${item.tagsId}`)
},
//
toStudy() {
uni.switchTab({
url: '/pages/study/study'
})
toProduct() {
this.$util.to('/order/products/products')
},
//
toDetail(item) {

@ -159,6 +159,7 @@
this.getStudy()
this.getSell()
this.getAnalysis()
uni.hideLoading()
},
//
getAuth() {
@ -219,7 +220,7 @@
}
this.list = data
this.getAuth()
this.initRole()
}).catch(e => {
uni.hideLoading()
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@ -40,18 +40,7 @@ ul {
background-color: #4876F9;
}
}
.filter {
display: flex;
align-items: center;
padding: 10rpx 30rpx 10rpx 10rpx;
background-color: #fff;
.search {
flex: 1;
}
.uni-searchbar__box {
height: 70rpx;
}
.sort {
@mixin sort {
margin: 0 20rpx 0 10rpx;
&:before {
content: '';
@ -72,6 +61,20 @@ ul {
&.asc:after {
border-top-color: #007EFF;
}
}
.filter {
display: flex;
align-items: center;
padding: 10rpx 30rpx 10rpx 10rpx;
background-color: #fff;
.search {
flex: 1;
}
.uni-searchbar__box {
height: 70rpx;
}
.sort {
@include sort;
}
}
.form-list {
@ -141,6 +144,9 @@ ul {
color: $uni-primary;
border-bottom-color: $uni-primary;
}
.sort {
@include sort;
}
}
.plus {
position: fixed;

Loading…
Cancel
Save