Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 456ec59d
authored
May 10, 2023
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
价格计算方法替换
1 parent
cab74383
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
30 deletions
app.js
config.js
package-lock.json
package.json
pages/accountItems/accountItems.js
store/index.js
tabIndex/pages/index/index.js
tabWorkOrder/pages/additionRecordOrder/additionRecordOrder.js
app.js
View file @
456ec59
...
@@ -26,12 +26,15 @@ App({
...
@@ -26,12 +26,15 @@ App({
wx
.
$eventbus
=
eventbus
wx
.
$eventbus
=
eventbus
let
userInfo
=
util
.
getStorageSync
(
'dj_boutique_user_info'
)
let
userInfo
=
util
.
getStorageSync
(
'dj_boutique_user_info'
)
userInfo
&&
checkYqdSuper
(
this
.
globalData
,
userInfo
)
// ,this.globalData, userInfo
userInfo
&&
this
.
gobalCheckYqdSuper
(
userInfo
)
},
},
showModal
(
that
,
options
)
{
showModal
(
that
,
options
)
{
that
.
selectComponent
(
'#modal'
).
showModal
(
options
)
that
.
selectComponent
(
'#modal'
).
showModal
(
options
)
},
},
gobalCheckYqdSuper
(
userInfo
){
checkYqdSuper
(
userInfo
,
this
.
globalData
)
},
onShow
(
options
)
{
onShow
(
options
)
{
getUpdateManager
()
getUpdateManager
()
...
...
config.js
View file @
456ec59
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* 2测试
* 2测试
* 3生产环境
* 3生产环境
*/
*/
let
index
=
1
let
index
=
3
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
accountInfo
=
wx
.
getAccountInfoSync
()
const
systemInfo
=
wx
.
getSystemInfoSync
()
const
systemInfo
=
wx
.
getSystemInfoSync
()
...
...
package-lock.json
View file @
456ec59
...
@@ -7,10 +7,10 @@
...
@@ -7,10 +7,10 @@
"resolved"
:
"https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.15.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.15.tgz"
,
"integrity"
:
"sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA=="
"integrity"
:
"sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA=="
},
},
"
bignumber.js
"
:
{
"
number-precision
"
:
{
"version"
:
"
9.1.1
"
,
"version"
:
"
1.6.0
"
,
"resolved"
:
"https://registry.npmmirror.com/
bignumber.js/-/bignumber.js-9.1.1
.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/
number-precision/-/number-precision-1.6.0
.tgz"
,
"integrity"
:
"sha512-
pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig
=="
"integrity"
:
"sha512-
05OLPgbgmnixJw+VvEh18yNPUo3iyp4BEWJcrLu4X9W05KmMifN7Mu5exYvQXqxxeNWhvIF+j3Rij+HmddM/hQ
=="
},
},
"rfdc"
:
{
"rfdc"
:
{
"version"
:
"1.3.0"
,
"version"
:
"1.3.0"
,
...
...
package.json
View file @
456ec59
{
{
"dependencies"
:
{
"dependencies"
:
{
"@vant/weapp"
:
"^1.10.14"
,
"@vant/weapp"
:
"^1.10.14"
,
"number-precision"
:
"^1.6.0"
,
"rfdc"
:
"^1.3.0"
"rfdc"
:
"^1.3.0"
}
}
}
}
pages/accountItems/accountItems.js
View file @
456ec59
...
@@ -252,8 +252,10 @@ Page({
...
@@ -252,8 +252,10 @@ Page({
app
.
globalData
.
yqdInfo
.
merchantRange
=
null
app
.
globalData
.
yqdInfo
.
merchantRange
=
null
app
.
globalData
.
YQorderSetting
=
null
app
.
globalData
.
YQorderSetting
=
null
wx
.
$util
.
hideLoading
()
wx
.
$util
.
hideLoading
()
console
.
log
(
app
);
wx
.
$util
.
setUserInfo
(
data
.
loginUserInfoList
[
0
])
wx
.
$util
.
setUserInfo
(
data
.
loginUserInfoList
[
0
])
checkYqdSuper
(
app
,
data
.
loginUserInfoList
[
0
])
app
.
gobalCheckYqdSuper
(
data
.
loginUserInfoList
[
0
])
// checkYqdSuper(app, data.loginUserInfoList[0])
// console.log(data.loginUserInfoList[0])
// console.log(data.loginUserInfoList[0])
getYQorderInfo
()
getYQorderInfo
()
const
SCENE
=
wx
.
$SCENE
const
SCENE
=
wx
.
$SCENE
...
...
store/index.js
View file @
456ec59
import
api
from
'~/api/api.js'
import
api
from
'~/api/api.js'
// const app = getApp()
// console.log(app, 'app')
// console.log(app, 'app')
// console.log(wx)
// console.log(wx)
globalData
/** 判断是不是超管角色 */
/** 判断是不是超管角色 */
export
const
checkYqdSuper
=
(
globalData
,
userInfo
)
=>
{
export
const
checkYqdSuper
=
(
userInfo
,
globalData
)
=>
{
let
merchantAccountType
=
userInfo
.
merchantAccountList
.
every
(
item
=>
{
let
merchantAccountType
=
userInfo
.
merchantAccountList
.
every
(
item
=>
{
return
item
==
6
||
item
==
8
return
item
==
6
||
item
==
8
})
})
// 解决传入app 在初始化获取不到的bug
// let app = getApp()
// const app = getApp()
// ?.globalData
// console.log(app);
globalData
.
isYqdSuper
=
userInfo
.
userType
!=
2
&&
!
userInfo
.
isSuper
&&
merchantAccountType
globalData
.
isYqdSuper
=
userInfo
.
userType
!=
2
&&
!
userInfo
.
isSuper
&&
merchantAccountType
globalData
.
isStaff
=
userInfo
.
userType
==
2
&&
!
userInfo
.
isSuper
&&
merchantAccountType
globalData
.
isStaff
=
userInfo
.
userType
==
2
&&
!
userInfo
.
isSuper
&&
merchantAccountType
console
.
log
(
globalData
.
isStaff
);
}
}
// 获取园区店信息
// 获取园区店信息
export
const
getYQInfo
=
userInfo
=>
{
export
const
getYQInfo
=
userInfo
=>
{
...
@@ -25,7 +30,9 @@ export const getYQInfo = userInfo => {
...
@@ -25,7 +30,9 @@ export const getYQInfo = userInfo => {
if
(
!
userInfo
.
isSuper
&&
userInfo
.
merchantType
&&
userInfo
.
userType
==
2
)
{
if
(
!
userInfo
.
isSuper
&&
userInfo
.
merchantType
&&
userInfo
.
userType
==
2
)
{
app
.
globalData
.
yqdInfo
=
{
app
.
globalData
.
yqdInfo
=
{
subIndex
,
subIndex
,
merchantRange
:
[{
merchantName
:
userInfo
.
merchantName
}]
merchantRange
:
[{
merchantName
:
userInfo
.
merchantName
}]
}
}
// this.setData({
// this.setData({
// merchantRange: [{ merchantName: userInfo.merchantName }]
// merchantRange: [{ merchantName: userInfo.merchantName }]
...
@@ -40,7 +47,10 @@ export const getYQInfo = userInfo => {
...
@@ -40,7 +47,10 @@ export const getYQInfo = userInfo => {
.
getYQList
()
.
getYQList
()
.
then
(
res
=>
{
.
then
(
res
=>
{
// console.log(res)
// console.log(res)
let
{
code
,
data
}
=
res
let
{
code
,
data
}
=
res
if
(
code
==
0
)
{
if
(
code
==
0
)
{
let
arr
=
[]
let
arr
=
[]
if
(
data
.
length
>
1
)
{
if
(
data
.
length
>
1
)
{
...
@@ -51,11 +61,9 @@ export const getYQInfo = userInfo => {
...
@@ -51,11 +61,9 @@ export const getYQInfo = userInfo => {
}
}
arr
=
[
all
,
...
data
]
arr
=
[
all
,
...
data
]
}
else
{
}
else
{
arr
=
[
arr
=
[{
{
merchantName
:
userInfo
.
merchantName
merchantName
:
userInfo
.
merchantName
}
}]
]
}
}
app
.
globalData
.
yqdInfo
=
{
app
.
globalData
.
yqdInfo
=
{
merchantRange
:
arr
,
merchantRange
:
arr
,
...
@@ -81,7 +89,10 @@ export const getYQorderInfo = () => {
...
@@ -81,7 +89,10 @@ export const getYQorderInfo = () => {
}
else
{
}
else
{
let
userInfo
=
wx
.
$util
.
getUserInfo
()
let
userInfo
=
wx
.
$util
.
getUserInfo
()
if
(
!
userInfo
)
this
.
login
(
true
)
if
(
!
userInfo
)
this
.
login
(
true
)
let
{
merchantId
,
merchantName
}
=
userInfo
.
subLoginUser
let
{
merchantId
,
merchantName
}
=
userInfo
.
subLoginUser
api
api
.
getMerchantRecordingSettings
({
.
getMerchantRecordingSettings
({
...
@@ -90,7 +101,10 @@ export const getYQorderInfo = () => {
...
@@ -90,7 +101,10 @@ export const getYQorderInfo = () => {
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
// console.log(res)
// console.log(res)
let
{
code
,
data
}
=
res
let
{
code
,
data
}
=
res
if
(
code
==
0
)
{
if
(
code
==
0
)
{
// debugger
// debugger
// console.log(typeof data.yqPhoneConfig, 'data.yqPhoneConfig')
// console.log(typeof data.yqPhoneConfig, 'data.yqPhoneConfig')
...
@@ -117,7 +131,9 @@ export const setConfigInfo = globalData => {
...
@@ -117,7 +131,9 @@ export const setConfigInfo = globalData => {
// 如果有 直接返回
// 如果有 直接返回
// console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting')
// console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting')
// console.log('app.globalData.YQorderSetting', app.globalData.YQorderSetting)
// console.log('app.globalData.YQorderSetting', app.globalData.YQorderSetting)
let
{
configInfo
}
=
globalData
let
{
configInfo
}
=
globalData
if
(
configInfo
)
{
if
(
configInfo
)
{
return
resolve
(
configInfo
)
return
resolve
(
configInfo
)
}
else
{
}
else
{
...
@@ -146,7 +162,9 @@ export const setConfigInfo = globalData => {
...
@@ -146,7 +162,9 @@ export const setConfigInfo = globalData => {
export
const
checkScene
=
options
=>
{
export
const
checkScene
=
options
=>
{
// let query = options.query
// let query = options.query
let
{
query
}
=
options
let
{
query
}
=
options
if
(
query
)
{
if
(
query
)
{
// 解码
// 解码
for
(
const
key
in
query
)
{
for
(
const
key
in
query
)
{
...
@@ -234,14 +252,23 @@ export const get4SStoreList = options => {
...
@@ -234,14 +252,23 @@ export const get4SStoreList = options => {
api
api
.
getSceneMerchantRefStoreList
(
options
)
.
getSceneMerchantRefStoreList
(
options
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
{
code
,
data
}
=
res
let
{
code
,
data
}
=
res
if
(
code
==
0
)
{
if
(
code
==
0
)
{
app
.
globalData
.
storeListRange
=
data
app
.
globalData
.
storeListRange
=
data
let
default4SStoreInfo
=
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo
?
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo
:
data
&&
data
[
0
]
let
default4SStoreInfo
=
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo
?
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo
:
data
&&
data
[
0
]
let
default4SStoreInfo_crowdFunding
=
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo_crowdFunding
?
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo_crowdFunding
:
data
&&
data
[
0
]
let
default4SStoreInfo_crowdFunding
=
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo_crowdFunding
?
wx
.
$util
.
getUserInfo
()?.
default4SStoreInfo_crowdFunding
:
data
&&
data
[
0
]
console
.
log
(
options
)
console
.
log
(
options
)
if
(
options
.
scene
==
0
)
wx
.
$util
.
setUserInfo
({
...
wx
.
$util
.
getUserInfo
(),
default4SStoreInfo
:
default4SStoreInfo
})
if
(
options
.
scene
==
0
)
wx
.
$util
.
setUserInfo
({
if
(
options
.
scene
==
3
)
wx
.
$util
.
setUserInfo
({
...
wx
.
$util
.
getUserInfo
(),
default4SStoreInfo_crowdFunding
:
default4SStoreInfo_crowdFunding
})
...
wx
.
$util
.
getUserInfo
(),
default4SStoreInfo
:
default4SStoreInfo
})
if
(
options
.
scene
==
3
)
wx
.
$util
.
setUserInfo
({
...
wx
.
$util
.
getUserInfo
(),
default4SStoreInfo_crowdFunding
:
default4SStoreInfo_crowdFunding
})
resolve
(
app
.
globalData
.
storeListRange
)
resolve
(
app
.
globalData
.
storeListRange
)
}
}
})
})
...
@@ -258,7 +285,10 @@ export const getStaffListByMerchant = options => {
...
@@ -258,7 +285,10 @@ export const getStaffListByMerchant = options => {
api
api
.
getStaffListByMerchantAPI
(
options
)
.
getStaffListByMerchantAPI
(
options
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
{
code
,
data
}
=
res
let
{
code
,
data
}
=
res
if
(
code
==
0
)
{
if
(
code
==
0
)
{
app
.
globalData
.
staffListRange
=
data
app
.
globalData
.
staffListRange
=
data
resolve
(
app
.
globalData
.
staffListRange
)
resolve
(
app
.
globalData
.
staffListRange
)
...
...
tabIndex/pages/index/index.js
View file @
456ec59
...
@@ -431,6 +431,7 @@ Page({
...
@@ -431,6 +431,7 @@ Page({
*/
*/
onShow
:
function
(
options
)
{
onShow
:
function
(
options
)
{
// console.log(options, 'options')
// console.log(options, 'options')
console
.
log
(
app
.
globalData
.
isStaff
,
'app.globalData.isStaff'
);
this
.
setData
({
this
.
setData
({
isStaff
:
app
.
globalData
.
isStaff
isStaff
:
app
.
globalData
.
isStaff
})
})
...
...
tabWorkOrder/pages/additionRecordOrder/additionRecordOrder.js
View file @
456ec59
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// import deepClone from '~/utils/deepClone'
// import deepClone from '~/utils/deepClone'
import
api
from
'../../api'
import
api
from
'../../api'
import
{
getYQorderInfo
}
from
'~/store/index'
import
{
getYQorderInfo
}
from
'~/store/index'
import
NP
from
'number-precision'
const
app
=
getApp
()
const
app
=
getApp
()
let
toastList
=
{
let
toastList
=
{
userId
:
'销售顾问不能为空'
,
userId
:
'销售顾问不能为空'
,
...
@@ -230,17 +231,24 @@ Page({
...
@@ -230,17 +231,24 @@ Page({
setGoodsTotal
(
goodsList
)
{
setGoodsTotal
(
goodsList
)
{
let
{
totalFee
}
=
this
.
data
let
{
totalFee
}
=
this
.
data
let
total
=
0
let
total
=
0
goodsList
.
map
(
i
=>
(
total
+=
i
.
count
*
i
.
price
))
// goodsList.map(i => (total += i.count * i.price))
goodsList
.
map
(
i
=>
{
const
totalPrice
=
NP
.
times
(
i
.
count
,
i
.
price
)
total
=
NP
.
plus
(
total
,
totalPrice
)
}
)
// 用来解决小数相减导致精度问题
// 用来解决小数相减导致精度问题
total
=
this
.
accMul
(
total
,
100
)
// total = this.accMul(total, 100)
total
=
parseFloat
(
total
.
toFixed
(
2
))
total
=
NP
.
times
(
total
,
100
)
// total = parseFloat(total.toFixed(2))
// console.log(total * 100)
// console.log(total * 100)
// console.log(totalFee)
// console.log(totalFee)
// console.log(totalFee * 100)
// console.log(totalFee * 100)
// 计算差价格 没有就归0 100是用来解决小数相减导致精度问题
// 计算差价格 没有就归0 100是用来解决小数相减导致精度问题
// console.log(this.accMul(total, 100))
// console.log(this.accMul(total, 100))
// 解决数据精度丢失问题
// 解决数据精度丢失问题
let
priceSpread
=
goodsList
.
length
?
parseFloat
((
total
-
totalFee
).
toFixed
(
2
))
:
0
// let priceSpread = goodsList.length ? parseFloat((total - totalFee).toFixed(2)) : 0
let
priceSpread
=
goodsList
.
length
?
NP
.
minus
(
total
,
totalFee
):
0
// console.log(priceSpread)
// console.log(priceSpread)
this
.
setData
({
this
.
setData
({
priceSpread
:
priceSpread
,
priceSpread
:
priceSpread
,
...
@@ -409,6 +417,8 @@ Page({
...
@@ -409,6 +417,8 @@ Page({
this
.
setData
({
this
.
setData
({
disabled
:
true
disabled
:
true
})
})
// console.log(object);
// return
api
api
.
supplementOrder
(
orderObj
)
.
supplementOrder
(
orderObj
)
.
then
(
res
=>
{
.
then
(
res
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment