Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e28c0117
authored
Nov 12, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
商品擦亮及无网络状态下显示提示
parent
f57773da
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
12 deletions
pages/tab/good/good.js
pages/tab/good/good.wxml
pages/tab/good/good.wxss
project.config.json
utils/api.js
utils/util.js
pages/tab/good/good.js
View file @
e28c0117
...
...
@@ -22,7 +22,8 @@ Page({
isShowBottom
:
false
,
isFixed
:
false
,
isShowTip
:
true
,
isdelete
:
false
isdelete
:
false
,
isCl
:
true
,
//是否已经擦亮了商品
},
/**
...
...
@@ -55,6 +56,61 @@ Page({
}
})
},
//获取是否已经擦亮商品
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
({
key
:
e
.
detail
.
value
...
...
@@ -109,7 +165,7 @@ Page({
if
(
me
.
data
.
p
==
1
)
{
me
.
setData
({
priceList
:
[],
total
:
0
total
:
0
})
}
if
(
isRefresh
)
{
...
...
@@ -141,7 +197,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
this
.
getUserInfo
()
},
/**
...
...
@@ -252,7 +308,6 @@ Page({
'goods_id'
:
JSON
.
stringify
(
data
)
},
function
(
res
)
{
if
(
res
.
errcode
===
0
)
{
//删除成功后手动将数据删除
wx
.
showToast
({
title
:
'删除成功'
,
icon
:
'none'
,
...
...
@@ -266,7 +321,7 @@ Page({
})
me
.
getData
();
wx
.
removeStorageSync
(
'deleteGoodsData'
);
},
1000
)
},
1000
)
}
})
...
...
pages/tab/good/good.wxml
View file @
e28c0117
...
...
@@ -46,7 +46,7 @@
<text>新增商品</text>
</view>
</view>
<view class="cl-good
" wx:if="{{priceList&&priceList.length!==0}}
">
<view class="cl-good
{{isCl?'disabled':'allow'}}" wx:if="{{priceList&&priceList.length!==0}}" catchtap="cLGoods
">
<view>擦亮</view>
<view>商品</view>
</view>
...
...
pages/tab/good/good.wxss
View file @
e28c0117
...
...
@@ -79,7 +79,6 @@
width:88rpx;
border-radius: 50%;
opacity: .8;
background-color: #EAAD37;
z-index: 99;
font-size: 24rpx;
color:#fff;
...
...
@@ -89,6 +88,12 @@
padding-top:12rpx;
box-sizing:border-box;
}
.cl-good.allow{
background-color: #EAAD37;
}
.cl-good.disabled{
background-color: #DAE1E7;
}
.bj-good{
background-color: #0D84D1;
bottom:300rpx;
...
...
project.config.json
View file @
e28c0117
...
...
@@ -52,7 +52,7 @@
"list"
:
[]
},
"miniprogram"
:
{
"current"
:
5
3
,
"current"
:
5
5
,
"list"
:
[
{
"id"
:
-1
,
...
...
@@ -429,6 +429,20 @@
"id"
:
-1
,
"name"
:
"pages/form/xj/index"
,
"pathName"
:
"pages/form/xj/index"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"pages/tab/home/home"
,
"pathName"
:
"pages/tab/home/home"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"pages/tab/good/good"
,
"pathName"
:
"pages/tab/good/good"
,
"scene"
:
null
}
]
...
...
utils/api.js
View file @
e28c0117
...
...
@@ -339,7 +339,11 @@ const apis = {
/**
* 批量删除商品
*/
goodsDelete
:
goods_url
+
'/goods/delete'
goodsDelete
:
goods_url
+
'/goods/delete'
,
/**
* 擦亮全部商品
*/
polishAll
:
goods_url
+
'/goods/polish/all'
}
...
...
utils/util.js
View file @
e28c0117
...
...
@@ -4,7 +4,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
wx
.
showNavigationBarLoading
();
var
token
,
header
,
tokenInvalid
;
var
token
,
header
;
//获取token
token
=
wx
.
getStorageSync
(
'access_token'
);
...
...
@@ -39,7 +39,33 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
"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
({
url
:
url
,
data
:
params
,
...
...
@@ -105,7 +131,6 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
}
})
};
//上传文件
const
uploadFile
=
(
url
,
path
,
callBack
)
=>
{
wx
.
showLoading
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment