tianyi 12 hours ago
parent
commit
1fb4b02c3e
  1. 120
      pages/shop/goodsList.vue
  2. 9
      pages/worker/partTimeJobCenter.vue

120
pages/shop/goodsList.vue

@ -138,7 +138,7 @@
</view> </view>
</view> </view>
</view> </view>
<view style="width:50rpx;height: 140rpx;"></view> <view style="width:10px;height:140rpx;"></view>
<u-loadmore v-if="showLoadmore" :status="status" /> <u-loadmore v-if="showLoadmore" :status="status" />
</scroll-view> </scroll-view>
</view> </view>
@ -164,6 +164,8 @@
</template> </template>
<script> <script>
const RECOMMEND_CATEGORY_ID = 'tuijian'
export default { export default {
data() { data() {
return { return {
@ -197,6 +199,7 @@
}, },
}, },
onShow() { onShow() {
this.getGategoryList() this.getGategoryList()
}, },
onLoad(option) { onLoad(option) {
@ -249,22 +252,19 @@
this.NB.sendRequest("/app/product/isPush", { this.NB.sendRequest("/app/product/isPush", {
id: item.id, id: item.id,
isPush:value isPush:value
}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
if(type == 'shopList'){ if(type == 'shopList'){
this.shopList[index].isPush = value this.shopList[index].isPush = value
if (this.categoryId == RECOMMEND_CATEGORY_ID && value != 1) {
this.shopList.splice(index, 1)
}
}else{ }else{
this.shopList1[index].isPush = value this.shopList1[index].isPush = value
} }
uni.showToast({ this.tui.toast('设置成功')
title: '设置成功',
icon: 'none'
})
} else { } else {
uni.showToast({ this.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
}, },
@ -273,24 +273,16 @@
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要删除该商品吗?', content: '确定要删除该商品吗?',
confirmText: '取消',
cancelText: '确认',
success: function (res) { success: function (res) {
if (res.cancel) { if (res.confirm) {
that.NB.sendRequest("/app/product/delById", { this.NB.sendRequest("/app/product/delById", {
id: v.id id: v.id
}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
that.getShareList() that.getShareList()
uni.showToast({ that.tui.toast('删除成功')
title: '删除成功',
icon: 'none'
})
} else { } else {
uni.showToast({ that.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
} }
@ -301,22 +293,16 @@
this.NB.sendRequest("/app/product/isMust", { this.NB.sendRequest("/app/product/isMust", {
id: item.id, id: item.id,
isMust:value isMust:value
}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
if(type == 'shopList'){ if(type == 'shopList'){
this.shopList[index].isMust = value this.shopList[index].isMust = value
}else{ }else{
this.shopList1[index].isMust = value this.shopList1[index].isMust = value
} }
uni.showToast({ this.tui.toast('设置成功')
title: '设置成功',
icon: 'none'
})
} else { } else {
uni.showToast({ this.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
}, },
@ -324,55 +310,44 @@
if(value == 0){ if(value == 0){
this.NB.sendRequest("/app/product/down", { this.NB.sendRequest("/app/product/down", {
id: item.id id: item.id
}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
if(type == 'shopList'){ if(type == 'shopList'){
this.shopList[index].delFlag = value this.shopList[index].delFlag = value
}else{ }else{
this.shopList1[index].delFlag = value this.shopList1[index].delFlag = value
} }
uni.showToast({ this.tui.toast('设置成功')
title: '设置成功',
icon: 'none'
})
} else { } else {
uni.showToast({ this.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
}else{ }else{
this.NB.sendRequest("/app/product/up", { this.NB.sendRequest("/app/product/up", {
id: item.id id: item.id
}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
if(type == 'shopList'){ if(type == 'shopList'){
this.shopList[index].delFlag = value this.shopList[index].delFlag = value
}else{ }else{
this.shopList1[index].delFlag = value this.shopList1[index].delFlag = value
} }
uni.showToast({ this.tui.toast('设置成功')
title: '设置成功',
icon: 'none'
})
} else { } else {
uni.showToast({ this.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
} }
}, },
goDetail(type,item){ goDetail(type,item){
let url="" let url=""
if(type == 'goods'){ if(type == 'goods'){
url = '/pages/shop/addGoods?dataList='+ JSON.stringify(item) url = '/package2/myCenter/addGoods?dataList='+ JSON.stringify(item)
}else if(type == 'type'){ }else if(type == 'type'){
url = '/pages/shop/addType' url = '/package2/myCenter/addType'
}else{ }else{
url = '/pages/shop/attributeList' url = '/package2/myCenter/attributeList'
} }
uni.navigateTo({ uni.navigateTo({
url:url url:url
@ -381,9 +356,12 @@
// //
getShareList(type) { getShareList(type) {
let data = {} let data = {}
const isSearch = type == 'search'
const isRecommend = !isSearch && this.categoryId == RECOMMEND_CATEGORY_ID
if (type == 'search') { if (type == 'search') {
this.gateType = 'search' this.gateType = 'search'
data = { data = {
shopId: this.shopId,
categoryId: "", categoryId: "",
searchStr: this.searchName, searchStr: this.searchName,
pageNum: this.pageNum, pageNum: this.pageNum,
@ -392,23 +370,25 @@
} else { } else {
this.gateType = '' this.gateType = ''
data = { data = {
categoryId: this.categoryId, shopId: this.shopId,
categoryId: isRecommend ? "" : this.categoryId,
searchStr: this.searchName, searchStr: this.searchName,
pageNum: this.pageNum, pageNum: this.pageNum,
pageSize: '10' pageSize: isRecommend ? '1000' : '10'
} }
} }
let that = this let that = this
this.NB.sendRequest("/app/product/getShareList", data, false, 'POST', 'application/json').then((res) => { this.NB.sendRequest("/app/product/getShareList", data, false, 'post', 'application/json').then((res) => {
if (res.code == 200) { if (res.code == 200) {
const records = res.result.records || [] const records = res.result.records || []
this.pages = res.result.pages || 1 const goodsList = isRecommend ? records.filter(item => item.isPush == 1) : records
this.pages = isRecommend ? 1 : (res.result.pages || 1)
if (type == 'search') { if (type == 'search') {
this.shopList = [] this.shopList = []
if (this.pageNum == 1) { if (this.pageNum == 1) {
this.shopList1 = records this.shopList1 = goodsList
} else { } else {
this.shopList1 = [...this.shopList1, ...records] this.shopList1 = [...this.shopList1, ...goodsList]
} }
for(let i=0;i<this.shopList1.length;i++){ for(let i=0;i<this.shopList1.length;i++){
this.shopList1[i].isShow = false this.shopList1[i].isShow = false
@ -416,9 +396,9 @@
} else { } else {
this.shopList1 = [] this.shopList1 = []
if (this.pageNum == 1) { if (this.pageNum == 1) {
this.shopList = records this.shopList = goodsList
} else { } else {
this.shopList = [...this.shopList, ...records] this.shopList = [...this.shopList, ...goodsList]
} }
for(let i=0;i<this.shopList.length;i++){ for(let i=0;i<this.shopList.length;i++){
this.shopList[i].isShow = false this.shopList[i].isShow = false
@ -426,12 +406,8 @@
} }
this.status = this.pageNum >= this.pages ? 'nomore' : 'loadmore' this.status = this.pageNum >= this.pages ? 'nomore' : 'loadmore'
} else { } else {
uni.showToast({ this.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
}, },
// //
@ -458,7 +434,11 @@
shopId:this.shopId shopId:this.shopId
}, false, 'get', 'application/x-www-form-urlencoded').then((res) => { }, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.indexList = res.result; const categoryList = res.result || []
this.indexList = [{
categoryName: '推荐',
id: RECOMMEND_CATEGORY_ID
}, ...categoryList];
if (this.indexList.length == 0) return; if (this.indexList.length == 0) return;
for (var i = 0; i < this.indexList.length; i++) { for (var i = 0; i < this.indexList.length; i++) {
if (i == 0) { if (i == 0) {
@ -470,12 +450,8 @@
this.categoryId = this.indexList[0].id this.categoryId = this.indexList[0].id
this.getShareList(); this.getShareList();
} else { } else {
uni.showToast({ this.tui.toast(res.message)
title: res.message,
icon: 'none'
})
} }
}) })
}, },
} }

9
pages/worker/partTimeJobCenter.vue

@ -240,11 +240,20 @@
cancelText: '确认', cancelText: '确认',
success: (res) => { success: (res) => {
if (res.cancel) { if (res.cancel) {
uni.showLoading({
title: '正在退出...',
mask: true
})
const worker = uni.getStorageSync('worker')
this.NB.sendRequest('/worker/offLine', {
id: worker.workerId
}, false, 'POST', 'application/x-www-form-urlencoded').then((res) => {})
uni.clearStorage() uni.clearStorage()
getApp().globalData.userinfo = '' getApp().globalData.userinfo = ''
uni.reLaunch({ uni.reLaunch({
url: '../login/login' url: '../login/login'
}) })
uni.hideLoading()
} }
} }
}) })

Loading…
Cancel
Save