Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
658a3e40
Commit
658a3e40
authored
Sep 07, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx weaqq: 页面更新 & 功能更新
1. 完成toOrder的操作
parent
a5dfd4c2
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
97 行增加
和
59 行删除
+97
-59
增值产品-小程序及app/nyx-master/config.js
+2
-1
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.js
+5
-5
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.wxml
+3
-3
增值产品-小程序及app/nyx-master/pages/activity/activity.wxml
+9
-8
增值产品-小程序及app/nyx-master/pages/mall/order/order.js
+74
-38
增值产品-小程序及app/nyx-master/pages/mall/order/order.wxml
+4
-4
没有找到文件。
增值产品-小程序及app/nyx-master/config.js
查看文件 @
658a3e40
//con
fig.js API全局域名配置
//con
fig.js API全局域名配置
...
...
@@ -48,6 +48,7 @@ var config={
activity_query_url
:
host_key
+
"/api/nyx/activity/query"
,
activity_period_query_url
:
host_key
+
"/api/nyx/activity/query/period"
,
order_detail_query_url
:
host_key
+
"/api/nyx/order/detail/query"
,
order_add_url
:
host_key
+
"/api/nyx/add/order"
,
match_query_url
:
host_key
+
"/api/nyx/match/query"
,
match_query_by_id_url
:
host_key
+
"/api/nyx/match/query/id"
,
match_query_then_update_url
:
host_key
+
"/api/nyx/match/queryThenUpdate/id"
,
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.js
查看文件 @
658a3e40
// pa
ges/activity/activity-info/activity-info.js
// pa
ges/activity/activity-info/activity-info.js
...
...
@@ -233,11 +233,11 @@ Page({
var
products_string
=
{}
for
(
var
i
=
0
;
i
<
res
.
data
.
data
.
length
;
i
++
)
{
var
result
=
{}
result
[
"product
_i
d"
]
=
res
.
data
.
data
[
i
].
productId
result
[
"product
_d
esc"
]
=
res
.
data
.
data
[
i
].
productDesc
result
[
"unit
_p
rice"
]
=
res
.
data
.
data
[
i
].
unitPrice
result
[
"product
I
d"
]
=
res
.
data
.
data
[
i
].
productId
result
[
"product
D
esc"
]
=
res
.
data
.
data
[
i
].
productDesc
result
[
"unit
P
rice"
]
=
res
.
data
.
data
[
i
].
unitPrice
result
[
"stock"
]
=
res
.
data
.
data
[
i
].
stock
result
[
"default
_s
tatus"
]
=
res
.
data
.
data
[
i
].
defaultStatus
result
[
"default
S
tatus"
]
=
res
.
data
.
data
[
i
].
defaultStatus
products
.
push
(
result
)
}
_this
.
setData
({
products
})
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.wxml
查看文件 @
658a3e40
<wxs
module="tutil" src="./../../../utils/date.wxs"></wxs>
<wxs
module="tutil" src="./../../../utils/date.wxs"></wxs>
...
...
@@ -15,7 +15,7 @@
<view class="note">
<view class="note-price" style="font-weight: bold">
<view class="clone">
<view class="clone-left">¥{{products[curIndex].unit
_p
rice}}</view>
<view class="clone-left">¥{{products[curIndex].unit
P
rice}}</view>
<!-- start 点赞 like -->
<block>
...
...
@@ -46,7 +46,7 @@
<span>类别:
<view class="cate-list {{curIndex==index?'on':''}}" wx:for="{{products}}"
wx:for-item="sub_item" wx:key="{{index}}" data-index="{{index}}" bindtap="switchCategory">
{{sub_item.product
_d
esc}}
{{sub_item.product
D
esc}}
</view>
</span>
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity.wxml
查看文件 @
658a3e40
<wxs
module="tutil" src="./../../utils/date.wxs"></wxs>
<wxs
module="tutil" src="./../../utils/date.wxs"></wxs>
...
...
@@ -45,13 +45,6 @@
<text>积分</text>
</view> -->
<!-- todo 0728 热销暂时也不实现 -->
<!-- todo 0828 我的活动暂时也不实现 -->
<!-- <view class="items">
<navigator url="/pages/my/my-orders/my-orders">
<image src="../../icon/activity/order.png"></image>
</navigator>
<text>我的活动</text>
</view> -->
<!-- jscat20200816 添加活动日历 for convinience -->
<block>
<view class="items">
...
...
@@ -69,6 +62,14 @@
</navigator>
</view>
<!-- todo 0828 我的活动暂时也不实现 -->
<view class="items">
<navigator url="/pages/my/my-orders/my-orders">
<image src="../../icon/activity/order.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
</navigator>
<text>我的活动</text>
</view>
</view>
</view>
...
...
增值产品-小程序及app/nyx-master/pages/mall/order/order.js
查看文件 @
658a3e40
// pa
ges/my/my-orders/my-orders.js
// pa
ges/my/my-orders/my-orders.js
...
...
@@ -20,9 +20,9 @@ Page({
/* 数量加减 */
totalPrice
:
0
,
totalCount
:
0
,
curIndex
:
0
,
selected_all
:
0
,
totalCount
:
0
,
},
...
...
@@ -65,14 +65,14 @@ Page({
if
(
curIndex
==
i
)
{
orderItems
[
i
][
'quantity'
]
=
1
orderItems
[
i
][
'
selected
'
]
=
1
totalPrice
=
orderItems
[
i
][
'unit
_p
rice'
]
orderItems
[
i
][
'
defaultStatus
'
]
=
1
totalPrice
=
orderItems
[
i
][
'unit
P
rice'
]
totalPrice
=
totalPrice
.
toFixed
(
2
)
}
else
{
orderItems
[
i
][
'quantity'
]
=
0
orderItems
[
i
][
'
selected
'
]
=
0
orderItems
[
i
][
'
defaultStatus
'
]
=
0
}
}
...
...
@@ -151,17 +151,17 @@ Page({
// 总数量+1
if
(
orderItems
[
index
][
'quantity'
]
<
1000
)
{
orderItems
[
index
][
'quantity'
]
=
orderItems
[
index
][
'quantity'
]
+
1
;
orderItems
[
index
][
'
selected
'
]
=
1
;
orderItems
[
index
][
'
defaultStatus
'
]
=
1
;
}
// 如果所有 商品的
selected
==1, 则selected_all=1
// 如果所有 商品的
defaultStatus
==1, 则selected_all=1
// 因为是addCount, 所以假定selected_all为1
selected_all
=
orderItems
[
index
][
'
selected
'
]
selected_all
=
orderItems
[
index
][
'
defaultStatus
'
]
for
(
var
i
=
0
;
i
<
orderItems
.
length
;
i
++
)
{
selected_all
=
orderItems
[
i
][
'
selected
'
]
==
1
?
selected_all
&&
1
:
0
totalPrice
=
orderItems
[
i
][
'
selected'
]
==
1
?
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unit_p
rice'
]))
:
totalPrice
totalCount
=
orderItems
[
i
][
'
selected
'
]
==
1
?
totalCount
+
orderItems
[
i
][
'quantity'
]:
totalCount
selected_all
=
orderItems
[
i
][
'
defaultStatus
'
]
==
1
?
selected_all
&&
1
:
0
totalPrice
=
orderItems
[
i
][
'
defaultStatus'
]
==
1
?
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unitP
rice'
]))
:
totalPrice
totalCount
=
orderItems
[
i
][
'
defaultStatus
'
]
==
1
?
totalCount
+
orderItems
[
i
][
'quantity'
]:
totalCount
}
totalPrice
=
totalPrice
.
toFixed
(
2
)
...
...
@@ -189,23 +189,23 @@ Page({
// 商品总数量-1
if
(
orderItems
[
index
][
'quantity'
]
>
1
)
{
orderItems
[
index
][
'quantity'
]
=
orderItems
[
index
][
'quantity'
]
-
1
;
orderItems
[
index
][
'
selected
'
]
=
1
;
orderItems
[
index
][
'
defaultStatus
'
]
=
1
;
}
// 如果减到0
// 当前商品的
selected
= 0
// 当前商品的
defaultStatus
= 0
// 所有商品的selected_all = 0
else
if
(
orderItems
[
index
][
'quantity'
]
==
1
)
{
orderItems
[
index
][
'quantity'
]
=
0
;
orderItems
[
index
][
'
selected
'
]
=
0
;
orderItems
[
index
][
'
defaultStatus
'
]
=
0
;
selected_all
=
0
;
}
//计算totalPrice和totalCount
for
(
var
i
=
0
;
i
<
orderItems
.
length
;
i
++
)
{
totalPrice
=
orderItems
[
i
][
'
selected'
]
==
1
?
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unit_p
rice'
]))
:
totalPrice
totalCount
=
orderItems
[
i
][
'
selected
'
]
==
1
?
totalCount
+
orderItems
[
i
][
'quantity'
]:
totalCount
totalPrice
=
orderItems
[
i
][
'
defaultStatus'
]
==
1
?
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unitP
rice'
]))
:
totalPrice
totalCount
=
orderItems
[
i
][
'
defaultStatus
'
]
==
1
?
totalCount
+
orderItems
[
i
][
'quantity'
]:
totalCount
}
totalPrice
=
totalPrice
.
toFixed
(
2
)
...
...
@@ -218,16 +218,6 @@ Page({
});
},
// 跳转到支付页面
// 目前暂时跳转到 /page/my/my.wxml
toPay
:
function
(
e
)
{
var
_this
=
this
;
var
url
=
"/pages/my/my"
wx
.
switchTab
({
url
:
url
});
},
//加法
add
:
function
(
arg1
,
arg2
)
{
var
r1
,
r2
,
m
;
...
...
@@ -278,7 +268,7 @@ Page({
},
// 单个商品 选择按钮
// 改变多选框状态 orderItems[i]['
selected
']: true || false
// 改变多选框状态 orderItems[i]['
defaultStatus
']: true || false
// 同步更新selected_all
// 同步改变totalPrice
radioTap
:
function
(
e
){
...
...
@@ -291,18 +281,18 @@ Page({
var
selected_all
=
_this
.
data
.
selected_all
var
totalPrice
=
0
;
var
totalCount
=
0
;
// 如果quantity==0, 则
selected
=0, selected_all=0
orderItems
[
dataId
].
selected
=
orderItems
[
dataId
].
selected
==
1
?
0
:
// 如果quantity==0, 则
defaultStatus
=0, selected_all=0
orderItems
[
dataId
].
defaultStatus
=
orderItems
[
dataId
].
defaultStatus
==
1
?
0
:
(
orderItems
[
dataId
][
'quantity'
]
>
0
?
1
:
0
)
//确定selected_all的值
selected_all
=
orderItems
[
dataId
].
selected
selected_all
=
orderItems
[
dataId
].
defaultStatus
for
(
var
i
=
0
;
i
<
orderItems
.
length
;
i
++
)
{
selected_all
=
orderItems
[
i
][
'
selected
'
]
==
1
?
selected_all
&&
1
:
0
totalPrice
=
orderItems
[
i
].
selected
==
0
?
totalPrice
:
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unit
_p
rice'
]))
totalCount
=
orderItems
[
i
].
selected
==
0
?
totalCount
:
totalCount
+
orderItems
[
i
][
'quantity'
]
selected_all
=
orderItems
[
i
][
'
defaultStatus
'
]
==
1
?
selected_all
&&
1
:
0
totalPrice
=
orderItems
[
i
].
defaultStatus
==
0
?
totalPrice
:
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unit
P
rice'
]))
totalCount
=
orderItems
[
i
].
defaultStatus
==
0
?
totalCount
:
totalCount
+
orderItems
[
i
][
'quantity'
]
}
totalPrice
=
totalPrice
.
toFixed
(
2
)
...
...
@@ -317,7 +307,7 @@ Page({
},
// 全选按钮
// 改变多选框状态 orderItems[i]['
selected
']: true || false
// 改变多选框状态 orderItems[i]['
defaultStatus
']: true || false
// 同步改变totalPrice
radioChangeAll
:
function
(
e
){
var
_this
=
this
...
...
@@ -332,10 +322,10 @@ Page({
// 改变后计算
for
(
var
i
=
0
;
i
<
orderItems
.
length
;
i
++
)
{
orderItems
[
i
][
'
selected
'
]
=
selected_all
==
1
?
(
orderItems
[
i
][
'quantity'
]
>
0
?
1
:
0
)
:
0
orderItems
[
i
][
'
defaultStatus
'
]
=
selected_all
==
1
?
(
orderItems
[
i
][
'quantity'
]
>
0
?
1
:
0
)
:
0
totalPrice
=
selected_all
==
0
?
0
:
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unit
_p
rice'
]))
totalCount
=
orderItems
[
i
].
selected
==
0
?
totalCount
:
totalCount
+
orderItems
[
i
][
'quantity'
]
_this
.
add
(
totalPrice
,
_this
.
mul
(
orderItems
[
i
][
'quantity'
],
orderItems
[
i
][
'unit
P
rice'
]))
totalCount
=
orderItems
[
i
].
defaultStatus
==
0
?
totalCount
:
totalCount
+
orderItems
[
i
][
'quantity'
]
}
totalPrice
=
totalPrice
.
toFixed
(
2
)
...
...
@@ -349,5 +339,50 @@ Page({
},
// 跳转到支付页面
// 目前暂时跳转到 /page/my/my.wxml
toPay
:
function
(
e
)
{
var
_this
=
this
;
var
strUrl
=
config
.
order_add_url
config
.
debug
==
1
?
console
.
log
(
"===uploadOrder strUrl "
+
strUrl
):
""
wx
.
request
({
url
:
strUrl
,
method
:
'POST'
,
data
:
{
activityId
:
_this
.
__data__
.
orderInfo
[
"activity_id"
],
userId
:
_this
.
data
.
nyxCode
,
productImage
:
_this
.
__data__
.
orderInfo
[
'product_image'
],
totalPrice
:
_this
.
data
.
totalPrice
,
totalCount
:
_this
.
data
.
totalCount
,
orderItemString
:
JSON
.
stringify
(
_this
.
data
.
orderItems
),
},
header
:
{
'content-type'
:
'application/x-www-form-urlencoded'
,
'Cookie'
:
wx
.
getStorageSync
(
'cookieKey'
),
},
dataType
:
"json"
,
success
:
function
(
res
)
{
if
(
res
.
data
.
resultCode
==
200
)
{
//表示提交成功
console
.
log
(
"===订单上传成功"
);
//重置数据
//回到首页
_this
.
toHome
();
}
}
})
},
//跳转到首页
toHome
:
function
(
e
)
{
wx
.
switchTab
({
url
:
"/pages/activity/activity"
});
},
})
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/mall/order/order.wxml
查看文件 @
658a3e40
<view
class="page">
<view
class="page">
...
...
@@ -20,13 +20,13 @@
<block wx:for="{{orderItems}}" wx:for-item="sub_item" wx:key="{{index}}">
<view class="note-row align">
<checkbox class="wx-checkbox-input wx-checkbox-input-checked" value="{{index}}" id="{{index}}" data-id="{{index}}" checked="{{sub_item.
selected
>0?true:false}}" bindtap="radioTap" />
<checkbox class="wx-checkbox-input wx-checkbox-input-checked" value="{{index}}" id="{{index}}" data-id="{{index}}" checked="{{sub_item.
defaultStatus
>0?true:false}}" bindtap="radioTap" />
<image class="writer-image" src="{{orderInfo.product_image}}"/>
<view class="note-column">
<span>{{sub_item.product_desc}}</span>
<span>
<view class="price-row">
<view class="sub-price">¥{{sub_item.unit
_p
rice}}</view>
<view class="sub-price">¥{{sub_item.unit
P
rice}}</view>
<!-- start 数量加减 -->
<view class="stepper">
...
...
@@ -75,7 +75,7 @@
<text style="color:#FF6600">¥{{totalPrice}}</text>
</view>
<view style="width:200rpx">
<button class="button-red" bindtap="to
Order
">确定({{totalCount}})</button>
<button class="button-red" bindtap="to
Pay
">确定({{totalCount}})</button>
</view>
</view>
</view>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论