Commit 05bd2add by 施宇

商品批量删除

parent 12bcb135
......@@ -103,7 +103,7 @@ Component({
roomType: false,
chatType: this.data.chatType,
success(id, serverMsgId) {
console.log('发送消息成功')
console.log('发送消息成功');
if (me.data.username.your == getApp().globalData.customerNum){//是客服就将客服加到接口的聊天列表里面
if (getApp().globalData.isAddCustomer){
......
......@@ -19,8 +19,11 @@ Component({
xb: {
type: Number // 询报价类型 1询价 2报价
},
isClick:{//是否可以点击
type:String
isClick: {//是否可以点击
type: String
},
isDelete: {//是否显示多选框
type: Boolean
}
},
......@@ -35,7 +38,7 @@ Component({
* 组件的方法列表
*/
methods: {
emitevent: function(e) {
emitevent: function (e) {
let inquiryItemsId = e.currentTarget.dataset.inquiryitemsid;
let goodId = e.currentTarget.dataset.goodid;
let offerId = e.currentTarget.dataset.offerid;
......@@ -43,7 +46,7 @@ Component({
let type = e.currentTarget.dataset.type; //1代表询价 2代表报价 3代表商品
let priceType = e.currentTarget.dataset.pricetype;
let isClick = e.currentTarget.dataset.isclick;
if(isClick==='0'){
if (isClick === '0') {
return;
}
if (judgeToken(true)) {
......@@ -74,14 +77,38 @@ Component({
}
} 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({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=1'
})
}
}
}
},
previewImage: function(e) {
previewImage: function (e) {
let img = e.currentTarget.dataset.image;
wx.previewImage({
urls: [img]
......
......@@ -143,8 +143,35 @@
<text class="address ellipsis">备注:{{item.remark||'--'}}</text>
</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}}">
<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">
......@@ -165,4 +192,5 @@
</view>
</view>
</block>
</block>
\ No newline at end of file
......@@ -100,3 +100,14 @@
color: #adb6bf;
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({
confirmKey: "",
isShowBottom: false,
isFixed: false,
isShowTip:true
isShowTip: true,
isdelete: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
let me = this;
if (judgeToken(true)) {
this.getData();
......@@ -53,12 +54,12 @@ Page({
}
})
},
bindKeyInput: function(e) {
bindKeyInput: function (e) {
this.setData({
key: e.detail.value
})
},
bindKeyConfirm: function() {
bindKeyConfirm: function () {
let key = this.data.key;
this.setData({
confirmKey: key,
......@@ -71,7 +72,7 @@ Page({
this.getData();
},
getData: function(isRefresh) {
getData: function (isRefresh) {
let me = this;
let token = wx.getStorageSync('access_token')
getData(apis.goodsInfo, 'get', {
......@@ -79,13 +80,14 @@ Page({
p: me.data.p,
token: token,
'goods_name/like': me.data.confirmKey
}, function(res) {
}, function (res) {
if (res.errcode === 0) {
let newArr = [];
if (me.data.p > 1) {
newArr = me.data.priceList;
}
for (let key in res.goods_list) {
res.goods_list[key].isdelete = false;
newArr.push(res.goods_list[key])
}
if (me.data.p == 1) {
......@@ -93,6 +95,7 @@ Page({
time: newArr[0].update_time
})
}
console.log(newArr)
me.setData({
priceList: newArr,
total: res.total,
......@@ -117,10 +120,10 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
onReady: function () {
},
onPageScroll: function(e) {
onPageScroll: function (e) {
if (e.scrollTop > 90) {
this.setData({
isFixed: true
......@@ -134,28 +137,28 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
onPullDownRefresh: function () {
this.setData({
p: 1,
isShowBottom: false
......@@ -166,7 +169,7 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
let allPage = Math.ceil(this.data.total / this.data.limit);
let p = this.data.p;
if (p == allPage) {
......@@ -181,14 +184,27 @@ Page({
this.getData();
}
},
closeTip:function(){
closeTip: function () {
this.setData({
isShowTip: false
});
},
fbGood: function() {
fbGood: function () {
wx.navigateTo({
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 @@
<text>新增商品</text>
</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}}">
<text class="line"></text>
<text class="text">我是有底线的</text>
......@@ -40,14 +40,22 @@
</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">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text>新增商品</text>
</view>
</view>
<!-- <view class="cl-good">
<view class="cl-good" wx:if="{{priceList&&priceList.length!==0}}">
<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>
\ No newline at end of file
......@@ -73,7 +73,7 @@
.nodata .add-good-btn {
margin-top: 40rpx;
}
.cl-good{
.cl-good,.bj-good{
position: fixed;
height:88rpx;
width:88rpx;
......@@ -84,8 +84,24 @@
font-size: 24rpx;
color:#fff;
right:24rpx;
bottom:150rpx;
bottom:180rpx;
text-align: center;
padding-top:12rpx;
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({
name: getApp().globalData.customerName,
name1: companyName,
id: userId,
touserid: '',
touserid: getApp().globalData.customerUserId,
title: getApp().globalData.customerName,
img: '',
img1: avatar
......
......@@ -52,7 +52,7 @@
"list": []
},
"miniprogram": {
"current": 30,
"current": 52,
"list": [
{
"id": -1,
......@@ -415,6 +415,13 @@
"id": -1,
"name": "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
}
]
......
const auth_url = 'https://authapi.icsales.com';
const so_url = 'https://soapi.icsales.com';
const offer_url = "https://offerapi.icsales.com";
const user_url = 'https://userapi.icsales.com';
const goods_url = 'https://goodsapi.icsales.com';
const home_url = 'https://home.icsales.com';
const welfare_url = 'https://welfareapi.icsales.com'
// const auth_url = 'http://authapi.icsales.cc';
// const so_url = 'http://soapi.icsales.cc';
// const offer_url = "http://offerapi.icsales.cc";
// const user_url = 'http://userapi.icsales.cc';
// const goods_url = 'http://goodsapi.icsales.cc';
// const home_url = 'http://home.icsales.cc';
// const welfare_url = 'http://welfareapi.icsales.cc';
// const auth_url = 'https://authapi.icsales.com';
// const so_url = 'https://soapi.icsales.com';
// const offer_url = "https://offerapi.icsales.com";
// const user_url = 'https://userapi.icsales.com';
// const goods_url = 'https://goodsapi.icsales.com';
// const home_url = 'https://home.icsales.com';
// const welfare_url = 'https://welfareapi.icsales.com'
const auth_url = 'http://authapi.icsales.cc';
const so_url = 'http://soapi.icsales.cc';
const offer_url = "http://offerapi.icsales.cc";
const user_url = 'http://userapi.icsales.cc';
const goods_url = 'http://goodsapi.icsales.cc';
const home_url = 'http://home.icsales.cc';
const welfare_url = 'http://welfareapi.icsales.cc';
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