Commit 05bd2add by 施宇

商品批量删除

parent 12bcb135
...@@ -103,7 +103,7 @@ Component({ ...@@ -103,7 +103,7 @@ Component({
roomType: false, roomType: false,
chatType: this.data.chatType, chatType: this.data.chatType,
success(id, serverMsgId) { success(id, serverMsgId) {
console.log('发送消息成功') console.log('发送消息成功');
if (me.data.username.your == getApp().globalData.customerNum){//是客服就将客服加到接口的聊天列表里面 if (me.data.username.your == getApp().globalData.customerNum){//是客服就将客服加到接口的聊天列表里面
if (getApp().globalData.isAddCustomer){ if (getApp().globalData.isAddCustomer){
......
...@@ -19,8 +19,11 @@ Component({ ...@@ -19,8 +19,11 @@ Component({
xb: { xb: {
type: Number // 询报价类型 1询价 2报价 type: Number // 询报价类型 1询价 2报价
}, },
isClick:{//是否可以点击 isClick: {//是否可以点击
type:String type: String
},
isDelete: {//是否显示多选框
type: Boolean
} }
}, },
...@@ -35,7 +38,7 @@ Component({ ...@@ -35,7 +38,7 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
emitevent: function(e) { emitevent: function (e) {
let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid; let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid;
let goodId = e.currentTarget.dataset.goodid; let goodId = e.currentTarget.dataset.goodid;
let offerId = e.currentTarget.dataset.offerid; let offerId = e.currentTarget.dataset.offerid;
...@@ -43,7 +46,7 @@ Component({ ...@@ -43,7 +46,7 @@ Component({
let type = e.currentTarget.dataset.type; //1代表询价 2代表报价 3代表商品 let type = e.currentTarget.dataset.type; //1代表询价 2代表报价 3代表商品
let priceType = e.currentTarget.dataset.pricetype; let priceType = e.currentTarget.dataset.pricetype;
let isClick = e.currentTarget.dataset.isclick; let isClick = e.currentTarget.dataset.isclick;
if(isClick==='0'){ if (isClick === '0') {
return; return;
} }
if (judgeToken(true)) { if (judgeToken(true)) {
...@@ -74,14 +77,38 @@ Component({ ...@@ -74,14 +77,38 @@ Component({
} }
} else if (priceType == 4) { } else if (priceType == 4) {
} else if (priceType == 5) { //tab页商品跳转 } else if (priceType == 5) { //个人主页商品跳转
wx.navigateTo({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=1'
})
} else if (priceType == 6) {//tab页商品跳转
if (this.data.isDelete) {
let index = e.currentTarget.dataset.index;
let isdelete = this.data.priceList[index].isdelete;
let deleteGoodsData = wx.getStorageSync('deleteGoodsData')||[];
let temp = 'priceList[' + index + '].isdelete'
this.setData({
[temp]: !isdelete
})
if(!isdelete){
//选中
deleteGoodsData.push(goodId)
}else{
//取消
let i = deleteGoodsData.indexOf(goodId);
deleteGoodsData.splice(i,1);
}
wx.setStorageSync('deleteGoodsData', deleteGoodsData)
} else {
wx.navigateTo({ wx.navigateTo({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=1' url: "/pages/detail/good/index?goodId=" + goodId + '&type=1'
}) })
} }
} }
}
}, },
previewImage: function(e) { previewImage: function (e) {
let img = e.currentTarget.dataset.image; let img = e.currentTarget.dataset.image;
wx.previewImage({ wx.previewImage({
urls: [img] urls: [img]
......
...@@ -144,7 +144,34 @@ ...@@ -144,7 +144,34 @@
</view> </view>
</view> </view>
</block> </block>
<!-- 商品管理 --> <!-- 商品tab页 -->
<block wx:if="{{priceType == 6}}">
<view class="price-item good-item row verCenter" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-goodid="{{item.goods_id}}" data-pricetype="6" data-index="{{index}}">
<view class="check-view" wx:if="{{isDelete}}">
<image src="{{item.isdelete?'/res/images/imgs/gx-icon.png':'/res/images/imgs/wgx-icon.png'}}"></image>
</view>
<view class="check-item ellipsis">
<view class="item-header row verCenter bothSide nowrap good-header">
<view class="row verCenter">
<text class="name ellipsis good-name">{{item.goods_name}}</text>
<block wx:if="{{item.goods_images}}">
<text class="icon iconfont iconiconxiantiaoshouji14 good-icon" catchtap="previewImage" data-image="{{item.goods_images}}"></text>
</block>
</view>
<text class="price">
<block wx:if="{{item.currency == 1}}">¥{{item.price}}</block>
<block wx:else>${{item.price}}</block>
</text>
</view>
<view class="item-middle row verCenter nowrap">
<text class="brand ellipsis"><text>品牌:</text>{{item.brand_name}}</text>
<text class="num"><text>库存:</text>{{item.stock}} PCS</text>
</view>
</view>
</view>
</block>
<!-- 主页商品浏览 -->
<block wx:if="{{priceType == 5}}"> <block wx:if="{{priceType == 5}}">
<view class="price-item good-item" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-goodid="{{item.goods_id}}" data-pricetype="5"> <view class="price-item good-item" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-goodid="{{item.goods_id}}" data-pricetype="5">
<view class="item-header row verCenter bothSide nowrap good-header"> <view class="item-header row verCenter bothSide nowrap good-header">
...@@ -165,4 +192,5 @@ ...@@ -165,4 +192,5 @@
</view> </view>
</view> </view>
</block> </block>
</block> </block>
\ No newline at end of file
...@@ -100,3 +100,14 @@ ...@@ -100,3 +100,14 @@
color: #adb6bf; color: #adb6bf;
font-size: 22rpx; font-size: 22rpx;
} }
.check-view{
flex:0 0 70rpx;
}
.check-item{
flex:1;
}
.check-view image{
height:46rpx;
width:46rpx;
}
...@@ -21,13 +21,14 @@ Page({ ...@@ -21,13 +21,14 @@ Page({
confirmKey: "", confirmKey: "",
isShowBottom: false, isShowBottom: false,
isFixed: false, isFixed: false,
isShowTip:true isShowTip: true,
isdelete: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function (options) {
let me = this; let me = this;
if (judgeToken(true)) { if (judgeToken(true)) {
this.getData(); this.getData();
...@@ -53,12 +54,12 @@ Page({ ...@@ -53,12 +54,12 @@ Page({
} }
}) })
}, },
bindKeyInput: function(e) { bindKeyInput: function (e) {
this.setData({ this.setData({
key: e.detail.value key: e.detail.value
}) })
}, },
bindKeyConfirm: function() { bindKeyConfirm: function () {
let key = this.data.key; let key = this.data.key;
this.setData({ this.setData({
confirmKey: key, confirmKey: key,
...@@ -71,7 +72,7 @@ Page({ ...@@ -71,7 +72,7 @@ Page({
this.getData(); this.getData();
}, },
getData: function(isRefresh) { getData: function (isRefresh) {
let me = this; let me = this;
let token = wx.getStorageSync('access_token') let token = wx.getStorageSync('access_token')
getData(apis.goodsInfo, 'get', { getData(apis.goodsInfo, 'get', {
...@@ -79,13 +80,14 @@ Page({ ...@@ -79,13 +80,14 @@ Page({
p: me.data.p, p: me.data.p,
token: token, token: token,
'goods_name/like': me.data.confirmKey 'goods_name/like': me.data.confirmKey
}, function(res) { }, function (res) {
if (res.errcode === 0) { if (res.errcode === 0) {
let newArr = []; let newArr = [];
if (me.data.p > 1) { if (me.data.p > 1) {
newArr = me.data.priceList; newArr = me.data.priceList;
} }
for (let key in res.goods_list) { for (let key in res.goods_list) {
res.goods_list[key].isdelete = false;
newArr.push(res.goods_list[key]) newArr.push(res.goods_list[key])
} }
if (me.data.p == 1) { if (me.data.p == 1) {
...@@ -93,6 +95,7 @@ Page({ ...@@ -93,6 +95,7 @@ Page({
time: newArr[0].update_time time: newArr[0].update_time
}) })
} }
console.log(newArr)
me.setData({ me.setData({
priceList: newArr, priceList: newArr,
total: res.total, total: res.total,
...@@ -117,10 +120,10 @@ Page({ ...@@ -117,10 +120,10 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function() { onReady: function () {
}, },
onPageScroll: function(e) { onPageScroll: function (e) {
if (e.scrollTop > 90) { if (e.scrollTop > 90) {
this.setData({ this.setData({
isFixed: true isFixed: true
...@@ -134,28 +137,28 @@ Page({ ...@@ -134,28 +137,28 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function() { onShow: function () {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function() { onHide: function () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function() { onUnload: function () {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function() { onPullDownRefresh: function () {
this.setData({ this.setData({
p: 1, p: 1,
isShowBottom: false isShowBottom: false
...@@ -166,7 +169,7 @@ Page({ ...@@ -166,7 +169,7 @@ Page({
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function() { onReachBottom: function () {
let allPage = Math.ceil(this.data.total / this.data.limit); let allPage = Math.ceil(this.data.total / this.data.limit);
let p = this.data.p; let p = this.data.p;
if (p == allPage) { if (p == allPage) {
...@@ -181,14 +184,27 @@ Page({ ...@@ -181,14 +184,27 @@ Page({
this.getData(); this.getData();
} }
}, },
closeTip:function(){ closeTip: function () {
this.setData({ this.setData({
isShowTip: false isShowTip: false
}); });
}, },
fbGood: function() { fbGood: function () {
wx.navigateTo({ wx.navigateTo({
url: "/pages/form/good/index", url: "/pages/form/good/index",
}) })
} },
editGoods: function () {
this.setData({
isdelete: true,
})
},
cancelGoods: function () {
this.setData({
isdelete: false,
})
},
deleteGoods: function () {
},
}) })
\ No newline at end of file
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<text>新增商品</text> <text>新增商品</text>
</view> </view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="5"></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="6" is-delete="{{isdelete}}"></priceItem>
<view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}"> <view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}">
<text class="line"></text> <text class="line"></text>
<text class="text">我是有底线的</text> <text class="text">我是有底线的</text>
...@@ -40,14 +40,22 @@ ...@@ -40,14 +40,22 @@
</view> </view>
</view> </view>
<view class="good-btn-div" wx:if="{{priceList&&priceList.length!==0}}"> <view class="good-btn-div" wx:if="{{(priceList&&priceList.length!==0) || isdelete}}">
<view class="btn-com btn-com-b add-good-btn" bindtap="fbGood"> <view class="btn-com btn-com-b add-good-btn" bindtap="fbGood">
<text class="icon iconfont iconiconxiantiaoshouji15"></text> <text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text> <text>新增商品</text>
</view> </view>
</view> </view>
<!-- <view class="cl-good"> <view class="cl-good" wx:if="{{priceList&&priceList.length!==0}}">
<view>擦亮</view> <view>擦亮</view>
<view>商品</view> <view>商品</view>
</view> --> </view>
<view class="bj-good" catchtap="editGoods" wx:if="{{priceList&&priceList.length!==0}}">
<view>编辑</view>
<view>商品</view>
</view>
<view class="good-btn-div row rowCenter" wx:if="{{isdelete}}">
<view class="btn-com cancel-btn" catchtap="cancelGoods">取消</view>
<view class="btn-com btn-com-b delete-btn" catchtap="deleteGoods">删除</view>
</view>
</view> </view>
\ No newline at end of file
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
.nodata .add-good-btn { .nodata .add-good-btn {
margin-top: 40rpx; margin-top: 40rpx;
} }
.cl-good{ .cl-good,.bj-good{
position: fixed; position: fixed;
height:88rpx; height:88rpx;
width:88rpx; width:88rpx;
...@@ -84,8 +84,24 @@ ...@@ -84,8 +84,24 @@
font-size: 24rpx; font-size: 24rpx;
color:#fff; color:#fff;
right:24rpx; right:24rpx;
bottom:150rpx; bottom:180rpx;
text-align: center; text-align: center;
padding-top:12rpx; padding-top:12rpx;
box-sizing:border-box; box-sizing:border-box;
} }
.bj-good{
background-color: #0D84D1;
bottom:300rpx;
}
.good-btn-div .cancel-btn,.good-btn-div .delete-btn{
box-sizing: border-box;
width:339rpx;
margin:0;
}
.good-btn-div .cancel-btn{
border:2rpx solid rgba(216,223,230,1);
background-color: #fff;
color:#686E73;
margin-right:24rpx;
line-height:94rpx;
}
...@@ -153,7 +153,7 @@ Page({ ...@@ -153,7 +153,7 @@ Page({
name: getApp().globalData.customerName, name: getApp().globalData.customerName,
name1: companyName, name1: companyName,
id: userId, id: userId,
touserid: '', touserid: getApp().globalData.customerUserId,
title: getApp().globalData.customerName, title: getApp().globalData.customerName,
img: '', img: '',
img1: avatar img1: avatar
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 30, "current": 52,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -415,6 +415,13 @@ ...@@ -415,6 +415,13 @@
"id": -1, "id": -1,
"name": "pages/list/signin/index", "name": "pages/list/signin/index",
"pathName": "pages/list/signin/index", "pathName": "pages/list/signin/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/tab/good/good",
"pathName": "pages/tab/good/good",
"scene": null "scene": null
} }
] ]
......
const auth_url = 'https://authapi.icsales.com'; // const auth_url = 'https://authapi.icsales.com';
const so_url = 'https://soapi.icsales.com'; // const so_url = 'https://soapi.icsales.com';
const offer_url = "https://offerapi.icsales.com"; // const offer_url = "https://offerapi.icsales.com";
const user_url = 'https://userapi.icsales.com'; // const user_url = 'https://userapi.icsales.com';
const goods_url = 'https://goodsapi.icsales.com'; // const goods_url = 'https://goodsapi.icsales.com';
const home_url = 'https://home.icsales.com'; // const home_url = 'https://home.icsales.com';
const welfare_url = 'https://welfareapi.icsales.com' // const welfare_url = 'https://welfareapi.icsales.com'
// const auth_url = 'http://authapi.icsales.cc'; const auth_url = 'http://authapi.icsales.cc';
// const so_url = 'http://soapi.icsales.cc'; const so_url = 'http://soapi.icsales.cc';
// const offer_url = "http://offerapi.icsales.cc"; const offer_url = "http://offerapi.icsales.cc";
// const user_url = 'http://userapi.icsales.cc'; const user_url = 'http://userapi.icsales.cc';
// const goods_url = 'http://goodsapi.icsales.cc'; const goods_url = 'http://goodsapi.icsales.cc';
// const home_url = 'http://home.icsales.cc'; const home_url = 'http://home.icsales.cc';
// const welfare_url = 'http://welfareapi.icsales.cc'; const welfare_url = 'http://welfareapi.icsales.cc';
const apis = { const apis = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment