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

9
pages/worker/partTimeJobCenter.vue

@ -240,11 +240,20 @@
cancelText: '确认',
success: (res) => {
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()
getApp().globalData.userinfo = ''
uni.reLaunch({
url: '../login/login'
})
uni.hideLoading()
}
}
})

Loading…
Cancel
Save