|
@@ -125,16 +125,16 @@ class Order extends Base
|
|
|
/** 默认地址 **/
|
|
|
$address = (new AddressModel)->where(['user_id' => $user_id, 'is_default' => AddressModel::IS_DEFAULT_YES])->find();
|
|
|
if ($address) {
|
|
|
- $area = (new Area)->whereIn('id', [$address->province_id, $address->city_id, $address->area_id])->column('name', 'id');
|
|
|
+ /*$area = (new Area)->whereIn('id', [$address->province_id, $address->city_id, $address->area_id])->column('name', 'id');
|
|
|
$address = $address->toArray();
|
|
|
$address['province']['name'] = $area[$address['province_id']];
|
|
|
$address['city']['name'] = $area[$address['city_id']];
|
|
|
- $address['area']['name'] = $area[$address['area_id']];
|
|
|
+ $address['area']['name'] = $area[$address['area_id']];*/
|
|
|
}
|
|
|
|
|
|
|
|
|
/** 可用优惠券 **/
|
|
|
- $coupon = CouponModel::all(function ($query) {
|
|
|
+ /*$coupon = CouponModel::all(function ($query) {
|
|
|
$time = time();
|
|
|
$query
|
|
|
->where(['switch' => CouponModel::SWITCH_ON])
|
|
@@ -143,24 +143,34 @@ class Order extends Base
|
|
|
});
|
|
|
if ($coupon) {
|
|
|
$coupon = collection($coupon)->toArray();
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
/** 运费数据 **/
|
|
|
- $cityId = $address['city_id'] ? $address['city_id'] : 0;
|
|
|
- $delivery = (new DeliveryRuleModel())->getDelivetyByArea($cityId);
|
|
|
+ /*$cityId = $address['city_id'] ? $address['city_id'] : 0;
|
|
|
+ $delivery = (new DeliveryRuleModel())->getDelivetyByArea($cityId);*/
|
|
|
+
|
|
|
+ $order_price = 0;
|
|
|
+ $delivery_price = 0;
|
|
|
|
|
|
foreach ($productData as &$product) {
|
|
|
$product['image'] = Config::getImagesFullUrl($product['image']);
|
|
|
$product['sales_price'] = round($product['sales_price'], 2);
|
|
|
$product['market_price'] = round($product['market_price'], 2);
|
|
|
+
|
|
|
+ $order_price = bcadd($order_price,$product['total_price'],2);
|
|
|
+ $delivery_price = bcadd($delivery_price,$product['yunfei_price'],2);
|
|
|
}
|
|
|
|
|
|
$this->success('', [
|
|
|
'product' => $productData,
|
|
|
'address' => $address,
|
|
|
- 'coupon' => $coupon,
|
|
|
- 'delivery' => $delivery['list'],
|
|
|
+// 'coupon' => $coupon,
|
|
|
+// 'delivery' => $delivery['list'],
|
|
|
+ 'order_price' => $order_price,
|
|
|
+ 'delivery_price' => $delivery_price,
|
|
|
+ 'total_price' => bcadd($order_price,$delivery_price,2),
|
|
|
+
|
|
|
'wallet' => Db::name('user_wallet')->where('user_id',$this->auth->id)->find(),
|
|
|
]);
|
|
|
|
|
@@ -192,6 +202,7 @@ class Order extends Base
|
|
|
public function submit()
|
|
|
{
|
|
|
$data = input();
|
|
|
+ $data['city_id'] = 2;
|
|
|
try {
|
|
|
$validate = Loader::validate('\\addons\\unishop\\validate\\Order');
|
|
|
if (!$validate->check($data, [], 'submit')) {
|