Commit cbde107e by 梁建民

Merge branch 'master' of http://119.23.72.7/shiyu/icsalesProgram

# Conflicts:
#	project.config.json
福利中心
parents 91f8503a 420c3544
...@@ -199,6 +199,7 @@ image { ...@@ -199,6 +199,7 @@ image {
.c-com { .c-com {
color: #515559; color: #515559;
word-break: break-all
} }
/**询报价列表**/ /**询报价列表**/
......
...@@ -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){
......
// components/priceItem/priceItem.js // components/priceItem/priceItem.js
import { import {
judgeToken judgeTokenNew
} from '../../utils/util.js'; } from '../../utils/util.js';
Component({ Component({
/** /**
...@@ -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,19 +46,24 @@ Component({ ...@@ -43,19 +46,24 @@ 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'){ let userid = e.currentTarget.dataset.userid;
let storageUserid = wx.getStorageSync('user_id');
if (isClick === '0') {
return; return;
} }
if (judgeToken(true)) { if (judgeTokenNew()) {
if (priceType == 1) { if (priceType == 1) {
if (type == 1) { if (type == 1) {
//查看自己的询价(别人给自己报的价)
wx.navigateTo({ wx.navigateTo({
url: "/pages/list/xj/index?type=1&inquiryItemsId=" + inquiryItemsId url: "/pages/list/xj/index?type=1&inquiryItemsId=" + inquiryItemsId
}) })
} else if (type == 2) { } else if (type == 2) {
//查看别人的询价(自己给别人报的价)
wx.navigateTo({ wx.navigateTo({
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
}) })
} }
} else if (priceType == 2) { //搜索页面商品跳转 } else if (priceType == 2) { //搜索页面商品跳转
...@@ -63,25 +71,49 @@ Component({ ...@@ -63,25 +71,49 @@ Component({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=2' url: "/pages/detail/good/index?goodId=" + goodId + '&type=2'
}) })
} else if (priceType == 3) { } else if (priceType == 3) {
if (type == 1) { if (userid == storageUserid){
wx.navigateTo({ //自己看自己的数据
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId
})
} else if (type == 2) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/detail/xj/index?inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId url: "/pages/list/xj/index?type=1&inquiryItemsId=" + inquiryItemsId
}) })
}else{
//自己看别人的数据
if (type == 1) {
wx.navigateTo({
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId
})
} else if (type == 2) {
wx.navigateTo({
url: "/pages/detail/xj/index?inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
})
}
} }
} else if (priceType == 4) { } else if (priceType == 4) {
} else if (priceType == 5) { //tab页商品跳转 } else if (priceType == 5) { //个人主页商品跳转
wx.navigateTo({ wx.navigateTo({
url: "/pages/detail/good/index?goodId=" + goodId + '&type=1' 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 data = {
index: index,
isdelete: this.data.priceList[index].isdelete,
goodId: goodId
}
//触发删除的自定义事件,逻辑在父组件中处理
this.triggerEvent('delete', data);
} else {
wx.navigateTo({
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]
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
</block> </block>
<!-- 搜索页面询报价展示 --> <!-- 搜索页面询报价展示 -->
<block wx:if="{{priceType==3}}"> <block wx:if="{{priceType==3}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="3" data-isclick="{{isClick}}"> <view class="price-item" wx:for="{{priceList}}" wx:key="{{index}}" catchtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="3" data-isclick="{{isClick}}" data-userid="{{item['user_id']}}">
<view class="item-header px-hr-bottom row verCenter bothSide nowrap"> <view class="item-header px-hr-bottom row verCenter bothSide nowrap">
<view class="row verCenter"> <view class="row verCenter">
<text class="mark xun" wx:if="{{xb==1}}">询价</text> <text class="mark xun" wx:if="{{xb==1}}">询价</text>
...@@ -143,8 +143,35 @@ ...@@ -143,8 +143,35 @@
<text class="address ellipsis">备注:{{item.remark||'--'}}</text> <text class="address ellipsis">备注:{{item.remark||'--'}}</text>
</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;
}
...@@ -20,7 +20,8 @@ Page({ ...@@ -20,7 +20,8 @@ Page({
currency: 0, currency: 0,
isClick: true, isClick: true,
isShowTip: true, isShowTip: true,
array: ['RMB','USD'] array: ['RMB','USD'],
date:"",
}, },
bindPickerChange: function (e) { bindPickerChange: function (e) {
this.setData({ this.setData({
...@@ -30,10 +31,10 @@ Page({ ...@@ -30,10 +31,10 @@ Page({
formSubmit: function(e) { formSubmit: function(e) {
let obj = e.detail.value; let obj = e.detail.value;
if (!obj.goods_name.trim().length) { if (!obj.goods_name.trim().length) {
tips('请填写型号'); tips('请填写商品型号');
return return
} else if (obj.goods_name.trim().length < 3) { } else if (obj.goods_name.trim().length < 3) {
tips('型号不能小于3个字符'); tips('商品型号不能小于3个字符');
return return
} else if (!obj.brand_name.trim().length) { } else if (!obj.brand_name.trim().length) {
tips('请填写品牌'); tips('请填写品牌');
...@@ -45,7 +46,7 @@ Page({ ...@@ -45,7 +46,7 @@ Page({
tips('请填写数量'); tips('请填写数量');
return return
} else if (isNaN(Number(obj.number.trim()))) { } else if (isNaN(Number(obj.number.trim()))) {
tips('数量必须为数字'); tips('需求数量必须为数字');
return return
} else { } else {
if (!fourPoint(obj.price)) { if (!fourPoint(obj.price)) {
...@@ -53,10 +54,10 @@ Page({ ...@@ -53,10 +54,10 @@ Page({
} }
if (obj.hq == 2) { //期货 if (obj.hq == 2) { //期货
if (!obj.day.trim().length) { if (!obj.day.trim().length) {
tips('请填写货期'); tips('请填写时间');
return return
} else if (obj.day.trim().length>6){ } else if (obj.day.trim().length>6){
tips('货期不能大于6个字符'); tips('时间不能大于6个字符');
return return
} }
} }
...@@ -170,5 +171,10 @@ Page({ ...@@ -170,5 +171,10 @@ Page({
this.setData({ this.setData({
isShowTip: false isShowTip: false
}) })
},
bindDateChange:function(e){
this.setData({
date: e.detail.value
})
} }
}) })
\ No newline at end of file
<!--pages/form/xj/index.wxml--> <!--pages/form/xj/index.wxml-->
<view class="form-view"> <view class="form-view-xj">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}"> <view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left row verCenter"> <view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text> <text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
...@@ -20,41 +20,41 @@ ...@@ -20,41 +20,41 @@
</view> </view>
<form bindsubmit="formSubmit"> <form bindsubmit="formSubmit">
<view class="form-item row verCenter"> <view class="form-item row verCenter">
<text class="form-item-title">*型号</text> <text class="form-item-title form-item-title-135">*商品型号</text>
<view class="form-item-right"> <view class="form-item-right">
<input placeholder="请输入产品型号(必填)" placeholder-class="placeholderClass" type="text" name="goods_name"></input> <input placeholder="请输入产品型号(必填)" placeholder-class="placeholderClass" type="text" name="goods_name"></input>
</view> </view>
</view> </view>
<view class="form-item row verCenter px-hr-top"> <view class="form-item row verCenter px-hr-top">
<text class="form-item-title">*品牌</text> <text class="form-item-title form-item-title-135">*品牌</text>
<view class="form-item-right"> <view class="form-item-right">
<input placeholder="请输入品牌(必填)" placeholder-class="placeholderClass" type="text" name="brand_name"></input> <input placeholder="请输入品牌(必填)" placeholder-class="placeholderClass" type="text" name="brand_name"></input>
</view> </view>
</view> </view>
<view class="form-item row verCenter px-hr-top"> <view class="form-item row verCenter px-hr-top">
<text class="form-item-title"> 封装</text> <text class="form-item-title form-item-title-135"> 封装</text>
<view class="form-item-right"> <view class="form-item-right">
<input placeholder="请输入封装" placeholder-class="placeholderClass" type="text" name="encap"></input> <input placeholder="请输入封装" placeholder-class="placeholderClass" type="text" name="encap"></input>
</view> </view>
</view> </view>
<view class="form-item row verCenter px-hr-top"> <view class="form-item row verCenter px-hr-top">
<text class="form-item-title">*数量</text> <text class="form-item-title form-item-title-135">*需求数量</text>
<view class="form-item-right"> <view class="form-item-right">
<input placeholder="请输入数量(必填)" placeholder-class="placeholderClass" type="number" name="number"></input> <input placeholder="请输入数量(必填)" placeholder-class="placeholderClass" type="number" name="number"></input>
</view> </view>
</view> </view>
<view class="form-item row verCenter px-hr-top bj-item"> <view class="form-item row verCenter px-hr-top bj-item">
<text class="form-item-title">*价格</text> <text class="form-item-title form-item-title-135">*接受价</text>
<view class="form-item-right row verCenter bothSide"> <view class="form-item-right row verCenter bothSide">
<input placeholder="请输入单价" placeholder-class="placeholderClass" type="digit" name="price"></input> <input placeholder="请输入单价" placeholder-class="placeholderClass" type="digit" name="price"></input>
<picker class="price-type" value="{{currency}}" range="{{array}}" bindchange="bindPickerChange"> <picker class="price-type" value="{{currency}}" range="{{array}}" bindchange="bindPickerChange">
<text class="price-value">{{array[currency]}}</text> <text class="price-value">{{array[currency]}}</text>
<text class="icon iconfont iconbianzu1"></text> <text class="icon iconfont iconbianzu1"></text>
</picker> </picker>
</view> </view>
</view> </view>
<view class="form-item row verCenter px-hr-top qx-item"> <view class="form-item row verCenter px-hr-top qx-item">
<text class="form-item-title">*货期</text> <text class="form-item-title form-item-title-135">*货期需求</text>
<view class="form-item-right"> <view class="form-item-right">
<radio-group name="hq" bindchange="radioChange"> <radio-group name="hq" bindchange="radioChange">
<label> <label>
...@@ -67,14 +67,26 @@ ...@@ -67,14 +67,26 @@
</view> </view>
</view> </view>
<view class="form-item row verCenter px-hr-top" hidden="{{!isShowTime}}"> <view class="form-item row verCenter px-hr-top" hidden="{{!isShowTime}}">
<text class="form-item-title">*时间</text> <text class="form-item-title form-item-title-135">*时间</text>
<view class="form-item-right"> <view class="form-item-right">
<input placeholder="请输入货期时间(天)" placeholder-class="placeholderClass" type="text" name="day"></input> <input placeholder="请输入货期时间(天)" placeholder-class="placeholderClass" type="text" name="day"></input>
</view> </view>
</view> </view>
<!-- <view class="form-hr"></view>
<view class="form-item row verCenter">
<text class="form-item-title form-item-title-165">*询价有效期</text>
<picker mode="date" value="{{date}}" start="2015-09-01" bindchange="bindDateChange" class="form-item-right jz-item-right">
<text wx:if="{{date}}">{{date}}</text>
<block wx:else>
<text>请选择截止日期</text>
<image src="/res/images/icons/left-icon.png"></image>
</block>
</picker>
</view> -->
<view class="form-hr"></view> <view class="form-hr"></view>
<view class="form-item row px-hr-bottom"> <view class="form-item row px-hr-bottom">
<text class="form-item-title">备注</text> <text class="form-item-title form-item-title-135">备注</text>
<view class="form-item-right"> <view class="form-item-right">
<textarea placeholder="请输入备注" placeholder-class="placeholderClass" maxlength="-1" name="remark" /> <textarea placeholder="请输入备注" placeholder-class="placeholderClass" maxlength="-1" name="remark" />
</view> </view>
......
/* pages/form/xj/index.wxss */ /* pages/form/xj/index.wxss */
@import '/res/css/form.wxss' @import '/res/css/form.wxss';
\ No newline at end of file
.form-view-xj .form-item-title-135 {
flex:0 0 135rpx;
text-align: left;
}
.form-view-xj .form-item-title-165 {
flex:0 0 165rpx;
text-align: left;
}
.form-view-xj .form-item-right{
padding: 0 24rpx 0 60rpx;
}
.jz-item-right{
text-align: right;
font-size:28rpx;
color:#8A9299;
}
.jz-item-right image{
width:16rpx;
height:27rpx;
vertical-align: middle;
margin-left:12rpx;
}
\ No newline at end of file
...@@ -95,6 +95,7 @@ Page({ ...@@ -95,6 +95,7 @@ Page({
wx.removeStorageSync('myPassword'); wx.removeStorageSync('myPassword');
wx.removeStorageSync('auth'); wx.removeStorageSync('auth');
wx.removeStorageSync('is_ShowModal') wx.removeStorageSync('is_ShowModal')
wx.removeStorageSync('deleteGoodsData')
// wx.removeStorageSync('imNick'); // wx.removeStorageSync('imNick');
wx.reLaunch({ wx.reLaunch({
url: '/pages/person/auth/index', url: '/pages/person/auth/index',
......
// pages/tab/good/good.js // pages/tab/good/good.js
import { import {
getData, getData,
judgeToken judgeTokenNew
} from '../../../utils/util.js'; } from '../../../utils/util.js';
import { import {
apis apis
...@@ -21,15 +21,22 @@ Page({ ...@@ -21,15 +21,22 @@ Page({
confirmKey: "", confirmKey: "",
isShowBottom: false, isShowBottom: false,
isFixed: false, isFixed: false,
isShowTip:true isShowTip: true,
isdelete: false,
isCl: true,//是否已经擦亮了商品
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function (options) {
let me = this; let me = this;
if (judgeToken(true)) { wx.removeStorageSync('deleteGoodsData');
if (judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
},true)) {
this.getData(); this.getData();
}; };
getApp().globalData.bus.on('addGood', () => { getApp().globalData.bus.on('addGood', () => {
...@@ -53,12 +60,67 @@ Page({ ...@@ -53,12 +60,67 @@ Page({
} }
}) })
}, },
bindKeyInput: function(e) { //获取是否已经擦亮商品
getUserInfo: function () {
let token = wx.getStorageSync('access_token') || '';
let me = this;
getData(apis.userInfo, 'get', {
"token": token,
}, function (res) {
if (res.errcode == 0) {
if (res.data.polish_status == 2) {//未刷新
me.setData({
isCl: false
})
} else {//已刷新
me.setData({
isCl: true
})
}
}
}, false)
},
//擦亮商品
cLGoods: function () {
if (!this.data.isCl) {
this.cLGoodsAjax()
}
},
//擦亮商品的请求
cLGoodsAjax: function () {
let token = wx.getStorageSync('access_token');
let me = this;
getData(apis.polishAll, 'get', {
token: token,
}, function (res) {
if (res.errcode === 0) {
wx.showToast({
title: '擦亮成功',
icon: 'none',
duration: 2000
})
me.setData({
isCl: true
})
} else {
wx.showToast({
title: '擦亮失败',
icon: 'none',
duration: 2000
});
me.setData({
isCl: false
})
}
}, true)
},
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,
...@@ -66,12 +128,14 @@ Page({ ...@@ -66,12 +128,14 @@ Page({
p: 1, p: 1,
total: 0, total: 0,
time: "", time: "",
isShowBottom: false isShowBottom: false,
isdelete: false
}); });
wx.removeStorageSync('deleteGoodsData');
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 +143,14 @@ Page({ ...@@ -79,13 +143,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) {
...@@ -103,7 +168,8 @@ Page({ ...@@ -103,7 +168,8 @@ Page({
} else if (res.errcode === 110001 || res.errcode === 103001) { } else if (res.errcode === 110001 || res.errcode === 103001) {
if (me.data.p == 1) { if (me.data.p == 1) {
me.setData({ me.setData({
priceList: [] priceList: [],
total: 0
}) })
} }
if (isRefresh) { if (isRefresh) {
...@@ -117,10 +183,10 @@ Page({ ...@@ -117,10 +183,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,31 +200,40 @@ Page({ ...@@ -134,31 +200,40 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function() { onShow: function () {
if (!judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
})) {
return;
}
this.getUserInfo();
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function() { onHide: function () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function() { onUnload: function () {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function() { onPullDownRefresh: function () {
wx.removeStorageSync('deleteGoodsData');
this.setData({ this.setData({
p: 1, p: 1,
isShowBottom: false isShowBottom: false,
isdelete: false
}); });
this.getData(true); this.getData(true);
}, },
...@@ -166,7 +241,7 @@ Page({ ...@@ -166,7 +241,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 +256,114 @@ Page({ ...@@ -181,14 +256,114 @@ 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,
});
let deleteGoodsData = wx.getStorageSync('deleteGoodsData') || [];
if (deleteGoodsData.length) {
for (let i = 0; i < this.data.priceList.length; i++) {
let index = deleteGoodsData.indexOf(this.data.priceList[i].goods_id);
if (index !== -1) {
let temp = 'priceList[' + i + '].isdelete';
this.setData({
[temp]: false
})
}
}
}
wx.removeStorageSync('deleteGoodsData');
},
deleteGoods: function () {
let deleteGoodsData = wx.getStorageSync('deleteGoodsData') || [];
let me = this;
if (!deleteGoodsData.length) {
return
}
wx.showModal({
title: '提示',
content: '是否确认删除当前选中的商品?',
confirmText: '取消',
confirmColor: "#0D84D1",
cancelText: "删除",
cancelColor: "#000000",
success(res) {
if (res.cancel) {
me.deleteGoodsAjax(deleteGoodsData)
}
}
})
},
//调用删除商品的接口
deleteGoodsAjax: function (data) {
let token = wx.getStorageSync('access_token');
let me = this;
getData(apis.goodsDelete, 'get', {
token: token,
'goods_id': JSON.stringify(data)
}, function (res) {
if (res.errcode === 0) {
wx.showToast({
title: '删除成功',
icon: 'none',
duration: 2000,
success: function () {
setTimeout(function () {
me.setData({
p: 1,
isShowBottom: false,
isdelete: false
})
me.getData();
wx.removeStorageSync('deleteGoodsData');
}, 1000)
}
})
} else {
wx.showToast({
title: '删除失败',
icon: 'none',
duration: 2000
})
}
}, true)
},
//子组件触发自定义的删除事件
onDelete: function (e) {
let index = e.detail.index;
let isdelete = e.detail.isdelete;
let goodId = e.detail.goodId
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)
} }
}) })
\ 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}}" bind:delete="onDelete"></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 {{isCl?'disabled':'allow'}}" wx:if="{{priceList&&priceList.length!==0}}" catchtap="cLGoods">
<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,19 +73,40 @@ ...@@ -73,19 +73,40 @@
.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;
border-radius: 50%; border-radius: 50%;
opacity: .8; opacity: .8;
background-color: #EAAD37;
z-index: 99; z-index: 99;
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;
} }
.cl-good.allow{
background-color: #EAAD37;
}
.cl-good.disabled{
background-color: #DAE1E7;
}
.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;
}
// pages/tab/home/home.js // pages/tab/home/home.js
import { import {
getData, getData,
judgeToken, judgeTokenNew,
interval interval
} from '../../../utils/util.js'; } from '../../../utils/util.js';
import { import {
...@@ -202,21 +202,21 @@ Page({ ...@@ -202,21 +202,21 @@ Page({
}) })
}, },
toWelfare: function () { toWelfare: function () {
if (judgeToken(true)) { if (judgeTokenNew()) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/person/welfare/index" url: "/pages/person/welfare/index"
}) })
} }
}, },
toXj: function () { toXj: function () {
if (judgeToken(true)) { if (judgeTokenNew()) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/form/xj/index" url: "/pages/form/xj/index"
}) })
} }
}, },
fbGood: function () { fbGood: function () {
if (judgeToken(true)) { if (judgeTokenNew()) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/form/good/index", url: "/pages/form/good/index",
}) })
...@@ -230,7 +230,7 @@ Page({ ...@@ -230,7 +230,7 @@ Page({
// } // }
}, },
toPrice:function(){ toPrice:function(){
if (judgeToken(true)) { if (judgeTokenNew()) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/tab/price/price" url: "/pages/tab/price/price"
}) })
......
...@@ -26,9 +26,7 @@ Page({ ...@@ -26,9 +26,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
if (!http.judgeToken(true)) {
return;
}
}, },
/** /**
...@@ -42,7 +40,13 @@ Page({ ...@@ -42,7 +40,13 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
if (!http.judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
})) {
return;
}
//获取数量统计 //获取数量统计
http.getData(apis.countBusiness, 'GET', { http.getData(apis.countBusiness, 'GET', {
token: wx.getStorageSync('access_token') token: wx.getStorageSync('access_token')
...@@ -153,7 +157,7 @@ Page({ ...@@ -153,7 +157,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
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
let disp = require("../../../utils/broadcast"); let disp = require("../../../utils/broadcast");
// let WebIM = require("../../../utils/WebIM")["default"]; // let WebIM = require("../../../utils/WebIM")["default"];
import { import {
judgeToken, judgeTokenNew,
getData, getData,
interval, interval,
matchReg, matchReg,
...@@ -31,7 +31,11 @@ Page({ ...@@ -31,7 +31,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
if (judgeToken(true)) { if (judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
}, true)) {
let me = this; let me = this;
let my = wx.getStorageSync("myUsername"); let my = wx.getStorageSync("myUsername");
//监听未读消息数 //监听未读消息数
...@@ -153,6 +157,13 @@ Page({ ...@@ -153,6 +157,13 @@ Page({
*/ */
onShow: function () { onShow: function () {
if (!judgeTokenNew(() => {
wx.switchTab({
url: '/pages/tab/home/home'
});
})) {
return;
}
let my = wx.getStorageSync("myUsername"); let my = wx.getStorageSync("myUsername");
let token = wx.getStorageSync('access_token') || ''; let token = wx.getStorageSync('access_token') || '';
let isShowModal = wx.getStorageSync('is_ShowModal')||'' let isShowModal = wx.getStorageSync('is_ShowModal')||''
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 30, "current": 55,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -420,29 +420,29 @@ ...@@ -420,29 +420,29 @@
}, },
{ {
"id": -1, "id": -1,
"name": "pages/person/certification/addcertification/index", "name": "pages/tab/good/good",
"pathName": "pages/person/certification/addcertification/index", "pathName": "pages/tab/good/good",
"query": "", "query": "",
"scene": null "scene": null
}, },
{ {
"id": -1, "id": -1,
"name": "pages/tab/me/me", "name": "pages/form/xj/index",
"pathName": "pages/tab/me/me", "pathName": "pages/form/xj/index",
"query": "", "query": "",
"scene": null "scene": null
}, },
{ {
"id": -1, "id": -1,
"name": "pages/person/welfare/index", "name": "pages/tab/home/home",
"pathName": "pages/person/welfare/index", "pathName": "pages/tab/home/home",
"query": "", "query": "",
"scene": null "scene": null
}, },
{ {
"id": -1, "id": -1,
"name": "pages/person/withdrawal/index", "name": "pages/tab/good/good",
"pathName": "pages/person/withdrawal/index", "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 = {
...@@ -335,7 +335,15 @@ const apis = { ...@@ -335,7 +335,15 @@ const apis = {
/** /**
* 确认兑换接口 * 确认兑换接口
*/ */
userExchangesConfirm: welfare_url + '/user_exchanges/exchange/confirm' userExchangesConfirm: welfare_url + '/user_exchanges/exchange/confirm',
/**
* 批量删除商品
*/
goodsDelete: goods_url + '/goods/delete',
/**
* 擦亮全部商品
*/
polishAll: goods_url + '/goods/polish/all'
} }
......
...@@ -49,7 +49,6 @@ const getImUser = () => { ...@@ -49,7 +49,6 @@ const getImUser = () => {
}else{ }else{
avatar = res.data.avatar avatar = res.data.avatar
} }
console.log(res)
wx.setStorageSync('avatar', avatar); wx.setStorageSync('avatar', avatar);
wx.setStorageSync('company_name', res.data.company_name || ''); wx.setStorageSync('company_name', res.data.company_name || '');
wx.setStorageSync("myUsername", res.data.im_username); wx.setStorageSync("myUsername", res.data.im_username);
......
...@@ -4,7 +4,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -4,7 +4,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
wx.showNavigationBarLoading(); wx.showNavigationBarLoading();
var token, header, tokenInvalid; var token, header;
//获取token //获取token
token = wx.getStorageSync('access_token'); token = wx.getStorageSync('access_token');
...@@ -23,7 +23,9 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -23,7 +23,9 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
//是否启用loading加载效果 //是否启用loading加载效果
if (loading) { if (loading) {
wx.showLoading(); wx.showLoading({
mask:true
});
} }
//是否启用请求头token //是否启用请求头token
...@@ -37,7 +39,33 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -37,7 +39,33 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
"Content-Type": "applciation/json" "Content-Type": "applciation/json"
} }
} }
wx.getNetworkType({
success(res) {
const networkType = res.networkType;
if (networkType !='none'){
//有网络
axios(url, type, params, callBack, loading, header)
}else{
wx.hideNavigationBarLoading();
if (loading) {
wx.hideLoading();
}
wx.showToast({
title: '网络出现异常',
icon: 'none',
duration: 2000
});
}
},
fail:function(){
axios(url, type, params, callBack, loading, header)
}
})
};
const axios = (url, type, params, callBack, loading, header) => {
let tokenInvalid;
wx.request({ wx.request({
url: url, url: url,
data: params, data: params,
...@@ -78,6 +106,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -78,6 +106,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
wx.removeStorageSync('myPassword'); wx.removeStorageSync('myPassword');
wx.removeStorageSync('auth'); wx.removeStorageSync('auth');
wx.removeStorageSync('is_ShowModal'); wx.removeStorageSync('is_ShowModal');
wx.removeStorageSync('deleteGoodsData');
WebIM.conn.close(); WebIM.conn.close();
// wx.removeStorageSync('imNick'); // wx.removeStorageSync('imNick');
wx.reLaunch({ wx.reLaunch({
...@@ -102,7 +131,6 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -102,7 +131,6 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
} }
}) })
}; };
//上传文件 //上传文件
const uploadFile = (url, path, callBack) => { const uploadFile = (url, path, callBack) => {
wx.showLoading({ wx.showLoading({
...@@ -301,6 +329,31 @@ const judgeToken = (boolen) => { ...@@ -301,6 +329,31 @@ const judgeToken = (boolen) => {
return false; return false;
} }
}; };
//判断token是否存在的新的逻辑
const judgeTokenNew = (cancelFun,modalHide) => {
let token = wx.getStorageSync('access_token');
if (token) {
return true
} else {
if(!modalHide){
wx.showModal({
title: '提示',
content: '亲,请登录体验更多功能',
confirmText: '登录',
success(res) {
if (res.confirm) {
wx.reLaunch({
url: '/pages/person/auth/index'
});
} else if (res.cancel) {
cancelFun && cancelFun()
}
}
})
}
return false;
}
};
const interval = (usedTime) => { const interval = (usedTime) => {
let days = Math.floor(usedTime / (24 * 3600 * 1000)); let days = Math.floor(usedTime / (24 * 3600 * 1000));
//计算出小时数 //计算出小时数
...@@ -376,5 +429,6 @@ module.exports = { ...@@ -376,5 +429,6 @@ module.exports = {
interval: interval, interval: interval,
matchReg: matchReg, matchReg: matchReg,
reloginIm: reloginIm, reloginIm: reloginIm,
fourPoint: fourPoint fourPoint: fourPoint,
judgeTokenNew: judgeTokenNew
} }
\ No newline at end of file
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