|
|
@@ -333,8 +333,8 @@ class DispatchService
|
|
|
'position_source' => 3,
|
|
|
'goods_count' => count($goodsItemList),
|
|
|
'goods_weight' => (float)$order['weight'],
|
|
|
- 'goods_total_amount_cent' => (int)($order['prePrice'] * 100),
|
|
|
- 'goods_actual_amount_cent' => (int)($order['actPrice'] * 100),
|
|
|
+ 'goods_total_amount_cent' => (int)($order['actPrice'] * 100),
|
|
|
+ 'goods_actual_amount_cent' => (int)($order['prePrice'] * 100),
|
|
|
'goods_item_list' => $goodsItemList,
|
|
|
'order_type' => 1,
|
|
|
'chain_store_id' => $platformShopId, // 蜂鸟平台 shopId
|
|
|
@@ -617,4 +617,106 @@ class DispatchService
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 格式化各平台报价为前端展示格式
|
|
|
+ *
|
|
|
+ * @param array $platformQuotes 各平台报价结果(来自 getAllPlatformPrice)
|
|
|
+ * @return array 格式化后的配送列表
|
|
|
+ */
|
|
|
+ public function formatPlatformQuotesForDisplay($platformQuotes)
|
|
|
+ {
|
|
|
+ $deliveryList = [];
|
|
|
+
|
|
|
+ if (empty($platformQuotes['quotes'])) {
|
|
|
+ return $deliveryList;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($platformQuotes['quotes'] as $item) {
|
|
|
+ switch ($item['platform']) {
|
|
|
+ case 'shunfeng':
|
|
|
+ $deliveryList[] = [
|
|
|
+ 'name' => '顺丰',
|
|
|
+ 'en_name' => 'shunfeng',
|
|
|
+ 'price' => $item['real_pay_money'],
|
|
|
+ 'distance' => $item['distance'],
|
|
|
+ 'type' => '',
|
|
|
+ 'isAble' => true
|
|
|
+ ];
|
|
|
+ break;
|
|
|
+ case 'shansong':
|
|
|
+ $deliveryList[] = [
|
|
|
+ 'name' => '闪送',
|
|
|
+ 'en_name' => 'shansong',
|
|
|
+ 'price' => $item['total_amount'],
|
|
|
+ 'distance' => $item['total_distance'],
|
|
|
+ 'type' => '',
|
|
|
+ 'issOrderNo' => $item['order_number'],
|
|
|
+ 'isAble' => true
|
|
|
+ ];
|
|
|
+ break;
|
|
|
+ case 'fengniao':
|
|
|
+ // 循环遍历 goods_infos 数组,提取有效项的信息
|
|
|
+ $validGoods = [];
|
|
|
+ if (!empty($item['goods_infos']) && is_array($item['goods_infos'])) {
|
|
|
+ foreach ($item['goods_infos'] as $good) {
|
|
|
+ if (!empty($good['is_valid']) && $good['is_valid'] == 1) {
|
|
|
+ $validGoods[] = [
|
|
|
+ 'actual_delivery_amount_cent' => $good['actual_delivery_amount_cent'] ?? 0,
|
|
|
+ 'service_goods_id' => $good['service_goods_id'] ?? ''
|
|
|
+ ];
|
|
|
+
|
|
|
+ $deliveryList[] = [
|
|
|
+ 'name' => '蜂鸟'. ' (' .$good['base_goods_id'] . ')',
|
|
|
+ 'en_name' => 'fengniao',
|
|
|
+ 'price' => $good['actual_delivery_amount_cent'],
|
|
|
+ 'distance' => $item['distance'],
|
|
|
+ 'valid_goods' => $validGoods,
|
|
|
+ 'type' => $good['slogan'],
|
|
|
+ 'isAble' => true
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ $deliveryList[] = [
|
|
|
+ 'name' => '蜂鸟'. ' (' .$good['base_goods_id'] . ')',
|
|
|
+ 'en_name' => 'fengniao',
|
|
|
+ 'price' => 0,
|
|
|
+ 'distance' => $item['distance'],
|
|
|
+ 'valid_goods' => $good,
|
|
|
+ 'type' => $good['disable_reason'],
|
|
|
+ 'isAble' => false
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'huolala':
|
|
|
+ foreach($item['price_info_list'] as $arr) {
|
|
|
+ $priceInfo = $arr['calculate_price_info'];
|
|
|
+ $vehicleType = $arr['vehicle_type'];
|
|
|
+ $deliveryList[] = [
|
|
|
+ 'name' => '货拉拉' . ' (' . $vehicleType['_meta']['vehicle_type'] . ')',
|
|
|
+ 'en_name' => 'huolala',
|
|
|
+ 'price' => $priceInfo['price_conditions'][0]['price_info']['total_price'],
|
|
|
+ 'distance' => $priceInfo['distance_info']['distance_total'],
|
|
|
+ 'type' => $vehicleType['_meta']['vehicle_type'],
|
|
|
+ 'isAble' => true,
|
|
|
+ // ---------------------------------------------
|
|
|
+ 'order_vehicle_id' => $vehicleType['order_vehicle_id'],
|
|
|
+ 'city_id' => $item['city_id'],
|
|
|
+ 'city_info_revision' => $vehicleType['city_info_revision'],
|
|
|
+ // 下单需要透传的数据
|
|
|
+ 'vehicle_std' => $vehicleType['vehicle_std'],
|
|
|
+ 'spec_req' => $vehicleType['spec_req'],
|
|
|
+ 'price_calculate_id' => $priceInfo['price_calculate_id'],
|
|
|
+ 'price_item_encryption' => $priceInfo['price_conditions'][0]['price_item_encryption'],
|
|
|
+ 'vehicle_attr' => $priceInfo['vehicle_info']['vehicle_attr'],
|
|
|
+ 'commodity_info' => $priceInfo['price_conditions'][0]['commodity_item'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $deliveryList;
|
|
|
+ }
|
|
|
}
|