Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
63e67aa0
ShopXO
项目概览
jamesyang1999
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
63e67aa0
编写于
3月 21, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
运费应用
上级
85002e5b
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
450 addition
and
126 deletion
+450
-126
application/admin/view/default/order/index.html
application/admin/view/default/order/index.html
+25
-0
application/api/controller/Goods.php
application/api/controller/Goods.php
+8
-0
application/api/controller/User.php
application/api/controller/User.php
+8
-7
application/index/controller/Cart.php
application/index/controller/Cart.php
+1
-1
application/index/view/default/buy/index.html
application/index/view/default/buy/index.html
+19
-7
application/index/view/default/order/detail.html
application/index/view/default/order/detail.html
+17
-0
application/plugins/freightfee/Hook.php
application/plugins/freightfee/Hook.php
+200
-13
application/plugins/freightfee/config.json
application/plugins/freightfee/config.json
+3
-1
application/plugins/touristbuy/Hook.php
application/plugins/touristbuy/Hook.php
+5
-4
application/plugins/view/freightfee/admin/index.html
application/plugins/view/freightfee/admin/index.html
+11
-0
application/plugins/view/freightfee/admin/saveinfo.html
application/plugins/view/freightfee/admin/saveinfo.html
+9
-4
application/plugins/view/touristbuy/index/detail.html
application/plugins/view/touristbuy/index/detail.html
+17
-0
application/service/BuyService.php
application/service/BuyService.php
+67
-47
application/service/OrderService.php
application/service/OrderService.php
+3
-0
application/tags.php
application/tags.php
+4
-0
extend/base/AlipayAuth.php
extend/base/AlipayAuth.php
+16
-10
public/appmini/old/alipay/app.js
public/appmini/old/alipay/app.js
+1
-1
public/appmini/old/alipay/pages/buy/buy.js
public/appmini/old/alipay/pages/buy/buy.js
+1
-1
public/appmini/old/alipay/pages/user-order/user-order.axml
public/appmini/old/alipay/pages/user-order/user-order.axml
+11
-11
public/appmini/old/weixin/pages/buy/buy.js
public/appmini/old/weixin/pages/buy/buy.js
+1
-1
public/appmini/old/weixin/pages/user-order/user-order.wxml
public/appmini/old/weixin/pages/user-order/user-order.wxml
+11
-12
public/static/index/default/css/buy.css
public/static/index/default/css/buy.css
+12
-4
public/static/index/default/css/order.detail.css
public/static/index/default/css/order.detail.css
+0
-1
public/static/plugins/css/touristbuy/index.detail.css
public/static/plugins/css/touristbuy/index.detail.css
+0
-1
未找到文件。
application/admin/view/default/order/index.html
浏览文件 @
63e67aa0
...
...
@@ -66,6 +66,7 @@
<th
class=
"am-hide-sm-only"
>
快递信息
</th>
<th>
订单状态
</th>
<th>
订单金额(元)
</th>
<th>
扩展数据
</th>
<th>
更多
</th>
<th>
操作
</th>
</tr>
...
...
@@ -127,10 +128,21 @@
</td>
<td>
金额:{{$v.price}}
<br
/>
增加:{{$v.increase_price}}
<br
/>
优惠:{{$v.preferential_price}}
<br
/>
总价:{{$v.total_price}}
<br
/>
支付:{{$v.pay_price}}
</td>
<td>
{{if empty($v['extension_data'])}}
<span
class=
"cr-ddd"
>
无
</span>
{{else /}}
{{foreach $v.extension_data as $extk=>$ext}}
{{if $extk gt 0}}
<br
/>
{{/if}}
{{$ext.name}} [{{$ext.tips}}]
{{/foreach}}
{{/if}}
</td>
<td>
<span
class=
"am-icon-caret-down c-p"
data-am-modal=
"{target: '#my-popup{{$v.id}}'}"
>
查看更多
</span>
<div
class=
"am-popup am-radius"
id=
"my-popup{{$v.id}}"
>
...
...
@@ -209,12 +221,25 @@
<span
class=
"cr-ddd"
>
未填写
</span>
{{else /}}
金额:{{$v.price}}
<br
/>
增加:{{$v.increase_price}}
<br
/>
优惠:{{$v.preferential_price}}
<br
/>
总价:{{$v.total_price}}
<br
/>
支付:{{$v.pay_price}}
{{/if}}
</dd>
<dt>
扩展数据
</dt>
<dd>
{{if empty($v['extension_data'])}}
<span
class=
"cr-ddd"
>
无
</span>
{{else /}}
{{foreach $v.extension_data as $extk=>$ext}}
{{if $extk gt 0}}
<br
/>
{{/if}}
{{$ext.name}} [{{$ext.tips}}]
{{/foreach}}
{{/if}}
</dd>
<dt>
确认时间
</dt>
<dd>
{{if empty($v['confirm_time'])}}
<span
class=
"cr-ddd"
>
未填写
</span>
{{else /}}{{$v.confirm_time}}{{/if}}
</dd>
...
...
application/api/controller/Goods.php
浏览文件 @
63e67aa0
...
...
@@ -117,6 +117,10 @@ class Goods extends Common
{
// 开始处理
$params
=
$this
->
data_post
;
if
(
isset
(
$_POST
[
'spec'
]))
{
$params
[
'spec'
]
=
$_POST
[
'spec'
];
}
return
GoodsService
::
GoodsSpecType
(
$params
);
}
...
...
@@ -132,6 +136,10 @@ class Goods extends Common
{
// 开始处理
$params
=
$this
->
data_post
;
if
(
isset
(
$_POST
[
'spec'
]))
{
$params
[
'spec'
]
=
$_POST
[
'spec'
];
}
return
GoodsService
::
GoodsSpecDetail
(
$params
);
}
...
...
application/api/controller/User.php
浏览文件 @
63e67aa0
...
...
@@ -91,15 +91,16 @@ class User extends Common
}
// 授权
$re
sul
t
=
(
new
\
base\AlipayAuth
())
->
GetAlipayUserInfo
(
$this
->
data_post
[
'authcode'
],
MyC
(
'common_app_mini_alipay_appid'
));
if
(
$re
sult
===
false
)
$ret
=
(
new
\
base\AlipayAuth
())
->
GetAlipayUserInfo
(
$this
->
data_post
[
'authcode'
],
MyC
(
'common_app_mini_alipay_appid'
));
if
(
$re
t
[
'status'
]
!=
0
)
{
return
DataReturn
(
'获取授权信息失败'
,
-
10
);
return
DataReturn
(
$ret
[
'msg'
]
,
-
10
);
}
else
{
$result
[
'gender'
]
=
empty
(
$result
[
'gender'
])
?
0
:
(
$result
[
'gender'
]
==
'm'
)
?
2
:
1
;
$result
[
'openid'
]
=
$result
[
'user_id'
];
$result
[
'referrer'
]
=
isset
(
$this
->
data_post
[
'referrer'
])
?
intval
(
$this
->
data_post
[
'referrer'
])
:
0
;
return
UserService
::
AuthUserProgram
(
$result
,
'alipay_openid'
);
$data
=
$ret
[
'data'
];
$data
[
'gender'
]
=
empty
(
$data
[
'gender'
])
?
0
:
(
$data
[
'gender'
]
==
'm'
)
?
2
:
1
;
$data
[
'openid'
]
=
$data
[
'user_id'
];
$data
[
'referrer'
]
=
isset
(
$this
->
data_post
[
'referrer'
])
?
intval
(
$this
->
data_post
[
'referrer'
])
:
0
;
return
UserService
::
AuthUserProgram
(
$data
,
'alipay_openid'
);
}
}
...
...
application/index/controller/Cart.php
浏览文件 @
63e67aa0
...
...
@@ -51,7 +51,7 @@ class Cart extends Common
$base
=
[
'total_price'
=>
empty
(
$cart_list
[
'data'
])
?
0
:
array_sum
(
array_column
(
$cart_list
[
'data'
],
'total_price'
)),
'
total_stock
'
=>
empty
(
$cart_list
[
'data'
])
?
0
:
array_sum
(
array_column
(
$cart_list
[
'data'
],
'stock'
)),
'
buy_count
'
=>
empty
(
$cart_list
[
'data'
])
?
0
:
array_sum
(
array_column
(
$cart_list
[
'data'
],
'stock'
)),
'ids'
=>
empty
(
$cart_list
[
'data'
])
?
''
:
implode
(
','
,
array_column
(
$cart_list
[
'data'
],
'id'
)),
];
$this
->
assign
(
'base'
,
$base
);
...
...
application/index/view/default/buy/index.html
浏览文件 @
63e67aa0
...
...
@@ -153,6 +153,13 @@
<div
class=
"table-no"
><i
class=
"am-icon-warning"
></i>
没有商品
</div>
{{/if}}
<!-- 含运费小计 -->
<div
class=
"buy-point-discharge"
>
<p>
合计
<span>
¥
</span><em
class=
"pay-sum"
>
{{$base.total_price}}
</em>
</p>
</div>
<!-- 留言 -->
<div
class=
"buy-message"
>
<div
class=
"order-extra"
>
...
...
@@ -165,12 +172,17 @@
</div>
</div>
<!-- 含运费小计 -->
<div
class=
"buy-point-discharge"
>
<p>
合计(含运费)
<span>
¥
</span><em
class=
"pay-sum"
>
{{$base.total_price}}
</em>
</p>
</div>
<!-- 扩展展示数据 -->
{{if !empty($extension_data)}}
<ul
class=
"buy-extension-data"
>
{{foreach $extension_data as $ext}}
<li>
<span
class=
"extension-items-name"
>
{{$ext.name}}
</span>
<span
class=
"am-fr extension-items-tips"
>
{{$ext.tips}}
</span>
</li>
{{/foreach}}
</ul>
{{/if}}
<!-- 信息 -->
<div
class=
"order-nav"
>
...
...
@@ -180,7 +192,7 @@
<em>
实付款:
</em>
<span
class=
"price"
>
<span>
¥
</span>
<em
class=
"nav-total-price"
>
{{$base.
tot
al_price}}
</em>
<em
class=
"nav-total-price"
>
{{$base.
actu
al_price}}
</em>
</span>
</div>
...
...
application/index/view/default/order/detail.html
浏览文件 @
63e67aa0
...
...
@@ -296,6 +296,17 @@
</table>
</div>
{{if !empty($data['extension_data'])}}
<div
class=
"am-alert am-alert-warning"
>
{{foreach $data.extension_data as $ertk=>$ext}}
<div
class=
"items"
>
<div
class=
"items-title am-fl"
>
{{$ext.name}}:
</div>
<div
class=
"items-detail am-fl"
>
{{$ext.tips}}
</div>
</div>
{{/foreach}}
</div>
{{/if}}
<div
class=
"am-alert am-alert-secondary"
>
{{if !empty($data.price)}}
<div
class=
"items"
>
...
...
@@ -303,6 +314,12 @@
<div
class=
"items-detail am-fl"
>
¥{{$data.price}}
</div>
</div>
{{/if}}
{{if !empty($data.increase_price)}}
<div
class=
"items"
>
<div
class=
"items-title am-fl"
>
增加金额:
</div>
<div
class=
"items-detail am-fl"
>
+¥{{$data.increase_price}}
</div>
</div>
{{/if}}
{{if !empty($data.preferential_price)}}
<div
class=
"items"
>
<div
class=
"items-title am-fl"
>
优惠金额:
</div>
...
...
application/plugins/freightfee/Hook.php
浏览文件 @
63e67aa0
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\plugins\freightfee
;
use
think\Controller
;
use
app\service\PluginsService
;
/**
* 运费设置 - 钩子入口
...
...
@@ -10,25 +19,203 @@ use think\Controller;
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Hook
extends
Controller
class
Hook
{
// 应用响应入口
/**
* 应用响应入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-09T14:25:44+0800
* @param [array] $params [输入参数]
*/
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
// is_backend 当前为后端业务处理
// hook_name 钩子名称
if
(
isset
(
$params
[
'is_backend'
])
&&
$params
[
'is_backend'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
if
(
!
empty
(
$params
[
'hook_name'
]))
{
// 参数一 描述
// 参数二 0 为处理成功, 负数为失败
// 参数三 返回数据
return
DataReturn
(
'返回描述'
,
0
);
switch
(
$params
[
'hook_name'
])
{
// 运费计算
case
'plugins_service_buy_handle'
:
$ret
=
$this
->
FreightFeeCalculate
(
$params
);
break
;
// 默认返回视图
default
:
$ret
=
''
;
}
return
$ret
;
}
}
/**
* 运费计算
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-21
* @desc description
* @param [array] $params [输入参数]
*/
public
function
FreightFeeCalculate
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'freightfee'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 是否设置运费数据
if
(
!
empty
(
$ret
[
'data'
][
'data'
][
0
]))
{
// 规则
$rules
=
$this
->
RulesHandle
(
$ret
[
'data'
][
'data'
],
$params
[
'data'
][
'base'
][
'address'
]);
// 计费方式
if
(
!
empty
(
$rules
))
{
$price
=
0
;
switch
(
$ret
[
'data'
][
'valuation'
])
{
// 按件
case
0
:
$price
=
$this
->
PieceCalculate
(
$rules
,
$params
[
'data'
]);
break
;
// 按量
case
1
:
$price
=
$this
->
QuantityCalculate
(
$rules
,
$params
[
'data'
]);
break
;
}
// 扩展展示数据
$show_name
=
empty
(
$ret
[
'data'
][
'show_name'
])
?
'运费'
:
$ret
[
'data'
][
'show_name'
];
$params
[
'data'
][
'extension_data'
][]
=
[
'name'
=>
$show_name
,
'price'
=>
$price
,
'type'
=>
0
,
'tips'
=>
'+¥'
.
$price
.
'元'
,
];
// 金额
$params
[
'data'
][
'base'
][
'increase_price'
]
+=
$price
;
$params
[
'data'
][
'base'
][
'actual_price'
]
+=
$price
;
}
return
DataReturn
(
'处理成功'
,
0
);
}
return
DataReturn
(
'无需处理'
,
0
);
}
else
{
return
'hello world!'
;
return
$ret
[
'msg'
];
}
}
/**
* 按重计费
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-21
* @desc description
* @param [array] $rules [规则]
* @param [array] $buy [生成订单数据]
*/
public
function
QuantityCalculate
(
$rules
,
$buy
)
{
$price
=
0
;
if
(
$rules
[
'first_price'
]
>
0
&&
$buy
[
'base'
][
'spec_weight_total'
]
>=
$rules
[
'first'
])
{
$price
=
$rules
[
'first_price'
];
}
if
(
$rules
[
'continue_price'
]
>
0
&&
$buy
[
'base'
][
'spec_weight_total'
]
>=
$rules
[
'continue'
]
+
$rules
[
'first'
])
{
$number
=
(
$buy
[
'base'
][
'spec_weight_total'
]
-
$rules
[
'first'
])
/
$rules
[
'continue'
];
if
(
$number
>
0
)
{
$price
+=
round
(
$rules
[
'continue_price'
]
*
$number
);
}
}
return
$price
;
}
/**
* 按件计费
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-21
* @desc description
* @param [array] $rules [规则]
* @param [array] $buy [生成订单数据]
*/
public
function
PieceCalculate
(
$rules
,
$buy
)
{
$price
=
0
;
if
(
$rules
[
'first_price'
]
>
0
&&
$buy
[
'base'
][
'buy_count'
]
>=
$rules
[
'first'
])
{
$price
=
$rules
[
'first_price'
];
}
if
(
$rules
[
'continue_price'
]
>
0
&&
$buy
[
'base'
][
'buy_count'
]
>=
$rules
[
'continue'
]
+
$rules
[
'first'
])
{
$number
=
round
((
$buy
[
'base'
][
'buy_count'
]
-
$rules
[
'first'
])
/
$rules
[
'continue'
]);
if
(
$number
>
0
)
{
$price
+=
round
(
$rules
[
'continue_price'
]
*
$number
);
}
}
return
$price
;
}
/**
* 运费规则匹配
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-21
* @desc description
* @param [array] $rules [运费规则列表]
* @param [array] $address [用户地址]
*/
public
function
RulesHandle
(
$rules
,
$address
)
{
if
(
count
(
$rules
)
>
1
&&
!
empty
(
$address
))
{
$data
=
[
'province'
=>
[
'rules'
=>
[],
'number'
=>
0
],
'city'
=>
[
'rules'
=>
[],
'number'
=>
0
],
];
foreach
(
$rules
as
$k
=>
$v
)
{
if
(
$k
!=
0
)
{
$region
=
explode
(
'-'
,
$v
[
'region'
]);
if
(
!
empty
(
$region
))
{
if
(
in_array
(
$address
[
'province'
],
$region
))
{
$data
[
'province'
][
'rules'
]
=
$v
;
$data
[
'province'
][
'number'
]
++
;
}
if
(
in_array
(
$address
[
'city'
],
$region
))
{
$data
[
'city'
][
'rules'
]
=
$v
;
$data
[
'city'
][
'number'
]
++
;
}
}
}
}
if
(
$data
[
'city'
][
'number'
]
>
0
)
{
if
(
$data
[
'province'
][
'number'
]
>
$data
[
'city'
][
'number'
])
{
return
$data
[
'province'
][
'rules'
];
}
return
$data
[
'city'
][
'rules'
];
}
else
{
if
(
$data
[
'province'
][
'number'
]
>
0
)
{
return
$data
[
'province'
][
'rules'
];
}
}
}
return
$rules
[
0
];
}
}
?>
\ No newline at end of file
application/plugins/freightfee/config.json
浏览文件 @
63e67aa0
...
...
@@ -21,6 +21,8 @@
"is_home"
:
false
},
"hook"
:{
"plugins_service_buy_handle"
:[
"app
\\
plugins
\\
freightfee
\\
Hook"
]
}
}
\ No newline at end of file
application/plugins/touristbuy/Hook.php
浏览文件 @
63e67aa0
...
...
@@ -25,11 +25,12 @@ use app\service\UserService;
class
Hook
extends
Controller
{
/**
*
钩子
入口
* @author
Guoguo
* @blog http://g
admin.cojz8.com
*
应用响应
入口
* @author
Devil
* @blog http://g
ong.gg/
* @version 1.0.0
* @datetime 2019年3月14日
* @datetime 2019-02-09T14:25:44+0800
* @param [array] $params [输入参数]
*/
public
function
run
(
$params
=
[])
{
...
...
application/plugins/view/freightfee/admin/index.html
浏览文件 @
63e67aa0
...
...
@@ -9,6 +9,17 @@
</legend>
<div
class=
"freightfee-content"
>
<div
class=
"items"
>
<label>
展示名称
</label>
<div>
{{if empty($data['show_name'])}}
运费
{{else /}}
{{$data.show_name}}
{{/if}}
</div>
</div>
<div
class=
"items"
>
<label>
计价方式
</label>
<div>
...
...
application/plugins/view/freightfee/admin/saveinfo.html
浏览文件 @
63e67aa0
...
...
@@ -10,6 +10,11 @@
<a
href=
"{{:PluginsAdminUrl('freightfee', 'admin', 'index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"business-form-block am-form-group"
>
<label>
展示名称
<span
class=
"am-form-group-label-tips"
>
默认 运费
</span></label>
<input
type=
"text"
name=
"show_name"
placeholder=
"展示名称"
maxlength=
"16"
data-validation-message=
"展示名称格式最多 16 个字符"
class=
"am-radius"
value=
"{{if !empty($data['show_name'])}}{{$data.show_name}}{{else /}}运费{{/if}}"
/>
</div>
<div
class=
"business-form-block am-form-group"
>
<label>
计价方式
</label>
<div>
...
...
@@ -75,12 +80,12 @@
{{if $v['region'] eq 'default'}}
<div
class=
"region-td none"
></div>
默认运费
<input
type=
"text"
class=
"am-radius region-name"
name=
"data[{{$k}}][region]"
data-validation-message=
"请选择地区"
value=
"default"
required
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region}}"
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region
_show
}}"
/>
{{else /}}
<div
class=
"region-td"
>
{{$v.region_names}}
</div>
<span
class=
"fs-12 cr-blue c-p line-edit"
data-index=
"{{$k}}"
>
添加地区
</span>
<input
type=
"text"
class=
"am-radius region-name"
name=
"data[{{$k}}][region]"
data-validation-message=
"请选择地区"
value=
"{{$v.region}}"
required
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region}}"
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region
_show
}}"
/>
{{/if}}
</td>
<td>
...
...
@@ -123,12 +128,12 @@
{{if $v['region'] eq 'default'}}
<div
class=
"region-td none"
></div>
默认运费
<input
type=
"text"
class=
"am-radius region-name"
name=
"data[{{$k}}][region]"
data-validation-message=
"请选择地区"
value=
"default"
required
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region}}"
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region
_show
}}"
/>
{{else /}}
<div
class=
"region-td"
>
{{$v.region_names}}
</div>
<span
class=
"fs-12 cr-blue c-p line-edit"
data-index=
"{{$k}}"
>
添加地区
</span>
<input
type=
"text"
class=
"am-radius region-name"
name=
"data[{{$k}}][region]"
data-validation-message=
"请选择地区"
value=
"{{$v.region}}"
required
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region}}"
/>
<input
type=
"hidden"
class=
"am-radius region-name-show"
name=
"data[{{$k}}][region_show]"
value=
"{{$v.region
_show
}}"
/>
{{/if}}
</td>
<td>
...
...
application/plugins/view/touristbuy/index/detail.html
浏览文件 @
63e67aa0
...
...
@@ -273,6 +273,17 @@
</table>
</div>
{{if !empty($data['extension_data'])}}
<div
class=
"am-alert am-alert-warning"
>
{{foreach $data.extension_data as $ertk=>$ext}}
<div
class=
"items"
>
<div
class=
"items-title am-fl"
>
{{$ext.name}}:
</div>
<div
class=
"items-detail am-fl"
>
{{$ext.tips}}
</div>
</div>
{{/foreach}}
</div>
{{/if}}
<div
class=
"am-alert am-alert-secondary"
>
{{if !empty($data.price)}}
<div
class=
"items"
>
...
...
@@ -280,6 +291,12 @@
<div
class=
"items-detail am-fl"
>
¥{{$data.price}}
</div>
</div>
{{/if}}
{{if !empty($data.increase_price)}}
<div
class=
"items"
>
<div
class=
"items-title am-fl"
>
增加金额:
</div>
<div
class=
"items-detail am-fl"
>
+¥{{$data.increase_price}}
</div>
</div>
{{/if}}
{{if !empty($data.preferential_price)}}
<div
class=
"items"
>
<div
class=
"items-title am-fl"
>
优惠金额:
</div>
...
...
application/service/BuyService.php
浏览文件 @
63e67aa0
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\Db
;
use
think\facade\Hook
;
use
app\service\GoodsService
;
use
app\service\UserService
;
use
app\service\ResourcesService
;
...
...
@@ -529,10 +530,29 @@ class BuyService
// 商品/基础信息
$total_price
=
empty
(
$goods
)
?
0
:
array_sum
(
array_column
(
$goods
,
'total_price'
));
$base
=
[
'total_price'
=>
$total_price
,
'actual_price'
=>
$total_price
,
'total_stock'
=>
empty
(
$goods
)
?
0
:
array_sum
(
array_column
(
$goods
,
'stock'
)),
'address'
=>
empty
(
$address
[
'data'
])
?
null
:
$address
[
'data'
],
// 总价
'total_price'
=>
$total_price
,
// 订单实际支付金额(已减去优惠金额, 已加上增加金额)
'actual_price'
=>
$total_price
,
// 优惠金额
'preferential_price'
=>
0.00
,
// 增加金额
'increase_price'
=>
0.00
,
// 商品数量
'goods_count'
=>
count
(
$goods
),
// 规格重量总计
'spec_weight_total'
=>
empty
(
$goods
)
?
0
:
array_sum
(
array_map
(
function
(
$v
)
{
return
$v
[
'spec_weight'
]
*
$v
[
'stock'
];},
$goods
)),
// 购买总数
'buy_count'
=>
empty
(
$goods
)
?
0
:
array_sum
(
array_column
(
$goods
,
'stock'
)),
// 默认地址
'address'
=>
empty
(
$address
[
'data'
])
?
null
:
$address
[
'data'
],
];
// 扩展展示数据
...
...
@@ -541,18 +561,12 @@ class BuyService
// type 类型(0减少, 1增加)
// tips 提示信息
$extension_data
=
[
[
'name'
=>
'感恩节9折'
,
'price'
=>
23
,
'type'
=>
0
,
'tips'
=>
'-¥23元'
],
[
'name'
=>
'运费'
,
'price'
=>
10
,
'type'
=>
1
,
'tips'
=>
'+¥10元'
],
// [
// 'name' => '感恩节9折',
// 'price' => 23,
// 'type' => 0,
// 'tips' => '-¥23元'
// ],
];
// 返回数据
...
...
@@ -561,6 +575,20 @@ class BuyService
'base'
=>
$base
,
'extension_data'
=>
$extension_data
,
];
// 生成订单数据处理钩子
$hook_name
=
'plugins_service_buy_handle'
;
$ret
=
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
&
$params
,
'data'
=>
&
$result
,
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
return
DataReturn
(
'操作成功'
,
0
,
$result
);
}
...
...
@@ -593,7 +621,6 @@ class BuyService
}
// 数据校验
$total_price
=
0
;
foreach
(
$params
[
'goods'
]
as
$v
)
{
// 获取商品信息
...
...
@@ -630,16 +657,9 @@ class BuyService
{
return
DataReturn
(
'['
.
$v
[
'goods_id'
]
.
']超过商品限购数量['
.
$v
[
'stock'
]
.
'>'
.
$goods
[
'buy_max_number'
]
.
']'
,
-
1
);
}
// 总价
$total_price
+=
$goods
[
'price'
]
*
$v
[
'stock'
];
$result
[]
=
$goods
;
}
$data
=
[
'total_price'
=>
$total_price
,
];
return
DataReturn
(
'操作成功'
,
0
,
$data
);
return
DataReturn
(
'操作成功'
,
0
);
}
/**
...
...
@@ -688,27 +708,25 @@ class BuyService
}
// 清单商品
$
goods
=
self
::
BuyTypeGoodsList
(
$params
);
if
(
!
isset
(
$
goods
[
'code'
])
||
$goods
[
'code'
]
!=
0
)
$
buy
=
self
::
BuyTypeGoodsList
(
$params
);
if
(
!
isset
(
$
buy
[
'code'
])
||
$buy
[
'code'
]
!=
0
)
{
return
$
goods
;
return
$
buy
;
}
$check
=
self
::
BuyGoodsCheck
([
'goods'
=>
$
goods
[
'data'
][
'goods'
]]);
$check
=
self
::
BuyGoodsCheck
([
'goods'
=>
$
buy
[
'data'
][
'goods'
]]);
if
(
!
isset
(
$check
[
'code'
])
||
$check
[
'code'
]
!=
0
)
{
return
$check
;
}
// 用户地址
$address
=
UserService
::
UserAddressRow
(
array_merge
(
$params
,
[
'id'
=>
$params
[
'address_id'
]]));
if
(
empty
(
$address
))
// 收货地址
if
(
empty
(
$buy
[
'data'
][
'base'
][
'address'
]))
{
return
$address
;
return
DataReturn
(
'收货地址有误'
,
-
1
);
}
else
{
$address
=
$buy
[
'data'
][
'base'
][
'address'
];
}
// 优惠金额
$preferential_price
=
0.00
;
// 店铺
$shop_id
=
0
;
...
...
@@ -717,18 +735,20 @@ class BuyService
'order_no'
=>
date
(
'YmdHis'
)
.
GetNumberCode
(
6
),
'user_id'
=>
$params
[
'user'
][
'id'
],
'shop_id'
=>
$shop_id
,
'receive_address_id'
=>
$address
[
'
data'
][
'
id'
],
'receive_name'
=>
$address
[
'
data'
][
'
name'
],
'receive_tel'
=>
$address
[
'
data'
][
'
tel'
],
'receive_province'
=>
$address
[
'
data'
][
'
province'
],
'receive_city'
=>
$address
[
'
data'
][
'
city'
],
'receive_county'
=>
$address
[
'
data'
][
'
county'
],
'receive_address'
=>
$address
[
'
data'
][
'
address'
],
'receive_address_id'
=>
$address
[
'id'
],
'receive_name'
=>
$address
[
'name'
],
'receive_tel'
=>
$address
[
'tel'
],
'receive_province'
=>
$address
[
'province'
],
'receive_city'
=>
$address
[
'city'
],
'receive_county'
=>
$address
[
'county'
],
'receive_address'
=>
$address
[
'address'
],
'user_note'
=>
isset
(
$params
[
'user_note'
])
?
htmlentities
(
$params
[
'user_note'
])
:
''
,
'status'
=>
(
intval
(
MyC
(
'common_order_is_booking'
,
0
))
==
1
)
?
0
:
1
,
'preferential_price'
=>
$preferential_price
,
'price'
=>
$check
[
'data'
][
'total_price'
],
'total_price'
=>
$check
[
'data'
][
'total_price'
]
-
$preferential_price
,
'preferential_price'
=>
$buy
[
'data'
][
'base'
][
'preferential_price'
],
'increase_price'
=>
$buy
[
'data'
][
'base'
][
'increase_price'
],
'price'
=>
$buy
[
'data'
][
'base'
][
'total_price'
],
'total_price'
=>
$buy
[
'data'
][
'base'
][
'actual_price'
],
'extension_data'
=>
empty
(
$buy
[
'data'
][
'extension_data'
])
?
''
:
json_encode
(
$buy
[
'data'
][
'extension_data'
]),
'payment_id'
=>
isset
(
$params
[
'payment_id'
])
?
intval
(
$params
[
'payment_id'
])
:
0
,
'add_time'
=>
time
(),
];
...
...
@@ -744,7 +764,7 @@ class BuyService
$order_id
=
Db
::
name
(
'Order'
)
->
insertGetId
(
$order
);
if
(
$order_id
>
0
)
{
foreach
(
$
goods
[
'data'
][
'goods'
]
as
$v
)
foreach
(
$
buy
[
'data'
][
'goods'
]
as
$v
)
{
$detail
=
[
'order_id'
=>
$order_id
,
...
...
application/service/OrderService.php
浏览文件 @
63e67aa0
...
...
@@ -648,6 +648,9 @@ class OrderService
{
$v
[
'user_note'
]
=
null
;
}
// 扩展数据
$v
[
'extension_data'
]
=
empty
(
$v
[
'extension_data'
])
?
null
:
json_decode
(
$v
[
'extension_data'
],
true
);
// 订单详情
$buy_number_count
=
0
;
...
...
application/tags.php
浏览文件 @
63e67aa0
...
...
@@ -120,5 +120,9 @@ return array (
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
),
'plugins_service_buy_handle'
=>
array
(
0
=>
'app\\plugins\\freightfee\\Hook'
,
),
);
?>
\ No newline at end of file
extend/base/AlipayAuth.php
浏览文件 @
63e67aa0
...
...
@@ -68,12 +68,12 @@ class AlipayAuth
$result
=
GS
(
$key
);
if
(
$result
!==
false
)
{
return
$result
;
return
[
'status'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$result
]
;
}
// 获取授权信息并且获取用户信息
$auth
=
$this
->
GetAuthAccessToken
(
$authcode
,
$app_id
);
if
(
$auth
!=
false
)
if
(
$auth
[
'status'
]
==
0
)
{
// 请求参数
$param
=
[
...
...
@@ -84,7 +84,7 @@ class AlipayAuth
'sign_type'
=>
'RSA2'
,
'timestamp'
=>
date
(
'Y-m-d H:i:s'
),
'version'
=>
'1.0'
,
'auth_token'
=>
$auth
[
'access_token'
],
'auth_token'
=>
$auth
[
'
data'
][
'
access_token'
],
];
// 生成签名参数+签名
...
...
@@ -99,17 +99,21 @@ class AlipayAuth
// 验证签名正确则存储缓存返回数据
if
(
!
$this
->
SyncRsaVerify
(
$result
,
'alipay_user_info_share_response'
))
{
return
false
;
return
[
'status'
=>-
1
,
'msg'
=>
'签名验证失败'
]
;
}
// 存储缓存
SS
(
$key
,
$result
[
'alipay_user_info_share_response'
]);
// 返回用户数据
return
$result
[
'alipay_user_info_share_response'
];
return
[
'status'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$result
[
'alipay_user_info_share_response'
]
];
}
$msg
=
empty
(
$result
[
'error_response'
][
'sub_msg'
])
?
'授权失败'
:
$result
[
'error_response'
][
'sub_msg'
];
return
[
'status'
=>-
1
,
'msg'
=>
$msg
];
}
else
{
return
$auth
;
}
return
false
;
}
/**
...
...
@@ -157,7 +161,7 @@ class AlipayAuth
{
if
(
empty
(
$app_id
)
||
empty
(
$key
)
||
(
empty
(
$authcode
)
&&
empty
(
$refresh_token
)))
{
return
false
;
return
[
'status'
=>-
1
,
'msg'
=>
'参数有误'
]
;
}
// 请求参数
...
...
@@ -188,20 +192,22 @@ class AlipayAuth
// 执行请求
$result
=
$this
->
HttpRequest
(
'https://openapi.alipay.com/gateway.do'
,
$param
);
// 结果正确则验证签名 并且 存储缓存返回access_token
if
(
!
empty
(
$result
[
'alipay_system_oauth_token_response'
][
'user_id'
]))
{
// 验证签名正确则存储缓存返回数据
if
(
!
$this
->
SyncRsaVerify
(
$result
,
'alipay_system_oauth_token_response'
))
{
return
false
;
return
[
'status'
=>-
1
,
'msg'
=>
'签名验证失败'
]
;
}
// 存储缓存
SS
(
$key
,
$result
[
'alipay_system_oauth_token_response'
]);
return
$result
[
'alipay_system_oauth_token_response'
];
return
[
'status'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$result
[
'alipay_system_oauth_token_response'
]
];
}
return
false
;
$msg
=
empty
(
$result
[
'error_response'
][
'sub_msg'
])
?
'授权失败'
:
$result
[
'error_response'
][
'sub_msg'
];
return
[
'status'
=>-
1
,
'msg'
=>
$msg
];
}
/**
...
...
public/appmini/old/alipay/app.js
浏览文件 @
63e67aa0
...
...
@@ -58,7 +58,7 @@ App({
// 请求地址
request_url
:
"
{{request_url}}
"
,
//request_url: "https://test.shopxo.net/",
//
request_url: 'http://tp5-dev.com/',
request_url
:
'
http://tp5-dev.com/
'
,
// 基础信息
application_title
:
"
{{application_title}}
"
,
...
...
public/appmini/old/alipay/pages/buy/buy.js
浏览文件 @
63e67aa0
...
...
@@ -86,7 +86,7 @@ Page({
}
else
{
this
.
setData
({
goods_list
:
data
.
goods_list
,
total_price
:
data
.
base
.
tot
al_price
,
total_price
:
data
.
base
.
actu
al_price
,
extension_data
:
data
.
extension_data
||
[],
data_list_loding_status
:
3
,
common_order_is_booking
:
data
.
common_order_is_booking
||
0
,
...
...
public/appmini/old/alipay/pages/user-order/user-order.axml
浏览文件 @
63e67aa0
...
...
@@ -31,17 +31,17 @@
<text class="buy-number">x{{detail.buy_number}}</text>
</view>
</navigator>
<view class="item-describe tr cr-666">{{item.describe}}
</view>
<view a:if="{{item.status <= 3}}" class="item-operation tr br-t"
>
<button a:if="{{item.status <= 1}}" class="submit-cancel" type="default" size="mini" onTap="cancel_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">取消
</button>
<button a:if="{{item.status == 1}}" class="submit-pay cr-666" type="default" size="mini" onTap="pay_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">支付
</button>
<button a:if="{{item.status == 2}}" class="submit-rush cr-666" type="default" size="mini" onTap="rush_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">催催
</button>
<button a:if="{{item.status == 3}}" class="submit-success cr-666" type="default" size="mini" onTap="collect_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">收货
</button>
</
view
>
</view>
<view class="item-describe tr cr-666">{{item.describe}}</view
>
<view a:if="{{item.status <= 3}}" class="item-operation tr br-t">
<button a:if="{{item.status <= 1}}" class="submit-cancel" type="default" size="mini" onTap="cancel_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">取消
</button>
<button a:if="{{item.status == 1}}" class="submit-pay cr-666" type="default" size="mini" onTap="pay_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">支付
</button>
<button a:if="{{item.status == 2}}" class="submit-rush cr-666" type="default" size="mini" onTap="rush_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">催催
</button>
<button a:if="{{item.status == 3}}" class="submit-success cr-666" type="default" size="mini" onTap="collect_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">收货
</
button
>
</view>
</view>
...
...
public/appmini/old/weixin/pages/buy/buy.js
浏览文件 @
63e67aa0
...
...
@@ -84,7 +84,7 @@ Page({
}
else
{
this
.
setData
({
goods_list
:
data
.
goods_list
,
total_price
:
data
.
base
.
tot
al_price
,
total_price
:
data
.
base
.
actu
al_price
,
extension_data
:
data
.
extension_data
||
[],
data_list_loding_status
:
3
,
common_order_is_booking
:
data
.
common_order_is_booking
||
0
,
...
...
public/appmini/old/weixin/pages/user-order/user-order.wxml
浏览文件 @
63e67aa0
...
...
@@ -31,18 +31,17 @@
<text class="buy-number">x{{detail.buy_number}}</text>
</view>
</navigator>
<view class="item-describe tr cr-666">{{item.describe}}
</view>
<view wx:if="{{item.status <= 3}}" class="item-operation tr br-t">
<button wx:if="{{item.status <= 1}}" class="submit-cancel" type="default" size="mini" bindtap="cancel_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">取消
</button>
<button wx:if="{{item.status == 1}}" class="submit-pay cr-666 br" type="default" size="mini" bindtap="pay_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">支付
</button>
<button wx:if="{{item.status == 2}}" class="submit-rush cr-666 br" type="default" size="mini" bindtap="rush_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">催催
</button>
<button wx:if="{{item.status == 3}}" class="submit-success cr-666 br" type="default" size="mini" bindtap="collect_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">收货
</button>
</view>
</view>
<view class="item-describe tr cr-666">{{item.describe}}</view>
<view wx:if="{{item.status <= 3}}" class="item-operation tr br-t">
<button wx:if="{{item.status <= 1}}" class="submit-cancel" type="default" size="mini" bindtap="cancel_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">取消
</button>
<button wx:if="{{item.status == 1}}" class="submit-pay cr-666 br" type="default" size="mini" bindtap="pay_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">支付
</button>
<button wx:if="{{item.status == 2}}" class="submit-rush cr-666 br" type="default" size="mini" bindtap="rush_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">催催
</button>
<button wx:if="{{item.status == 3}}" class="submit-success cr-666 br" type="default" size="mini" bindtap="collect_event" data-value="{{item.id}}" data-index="{{index}}" hover-class="none">收货
</button>
</view>
</view>
...
...
public/static/index/default/css/buy.css
浏览文件 @
63e67aa0
...
...
@@ -28,8 +28,8 @@ ul.logistics-list li.selected i.icon-active, ul.payment-list li.selected i.icon-
.business-item
ul
{
padding
:
10px
3px
5px
5px
;}
ul
.logistics-list
li
img
,
ul
.payment-list
li
img
{
width
:
36px
;
height
:
36px
;
}
/*运费、留言*/
.buy-message
{
padding
:
0px
5px
}
/*运费、留言
、扩展数据
*/
.buy-message
{
padding
:
0px
5px
}
.td.td-oplist
.pay-logis
,
.td.td-bonus
select
{
position
:
absolute
;
top
:
6px
;
right
:
0
;}
.memo-input
{
width
:
calc
(
100%
-
64px
);
border
:
1px
solid
#ccc
;
padding
:
5px
;
outline
:
none
;
border-radius
:
2px
;}
...
...
@@ -46,6 +46,13 @@ ul.logistics-list li img, ul.payment-list li img { width: 36px; height: 36px; }
ul
.address-list
,
.business-item
ul
{
overflow
:
hidden
;
}
.nav-buy
.btn-go.am-disabled
{
background-color
:
#efa4af
;
}
/* 扩展数据 */
.buy-extension-data
{
background
:
#ffffeb
;
border
:
1px
solid
#ffe2cf
;
margin-top
:
10px
;
padding
:
5px
10px
;
margin
:
10px
5px
0
5px
;
}
.buy-extension-data
li
{
padding
:
5px
0
;
}
.buy-extension-data
li
:not
(
:last-child
)
{
border-bottom
:
1px
dashed
#ffe2cf
;
}
.buy-extension-data
.extension-items-name
{
}
.buy-extension-data
.extension-items-tips
{
color
:
#ff8f44
;
}
/**
* 手机下选择地址
*/
...
...
@@ -91,8 +98,6 @@ ul.address-list, .business-item ul { overflow: hidden; }
.base-real-pay
.g_price
span
{
font-size
:
26px
;}
.price
.nav-total-price
{
color
:
#d2364c
;
font
:
700
26px
tahoma
;}
.order-nav
.buy-footer-address
.buy-line-title
{
color
:
#404040
;
font-weight
:
700
;}
.link-list
{
margin
:
0px
auto
;}
/*地址管理*/
.address
ul
{
margin-top
:
10px
;}
...
...
@@ -121,6 +126,9 @@ ul.address-list, .business-item ul { overflow: hidden; }
.link-list
h3
{
padding
:
0
0
5px
0
;
}
.buy-message
{
margin
:
0
;
}
.buy-point-discharge
{
padding
:
10px
0px
;
}
/*扩展数据*/
.buy-extension-data
{
margin
:
10px
0
0
0
;
}
}
@media
only
screen
and
(
max-width
:
640px
)
{
...
...
public/static/index/default/css/order.detail.css
浏览文件 @
63e67aa0
...
...
@@ -110,7 +110,6 @@ ul.progress li.current .title {
overflow
:
hidden
;
}
.items-detail
{
width
:
calc
(
100%
-
62px
);
color
:
#666
;
}
...
...
public/static/plugins/css/touristbuy/index.detail.css
浏览文件 @
63e67aa0
...
...
@@ -110,7 +110,6 @@ ul.progress li.current .title {
overflow
:
hidden
;
}
.items-detail
{
width
:
calc
(
100%
-
62px
);
color
:
#666
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录