PurchaseController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <?php
  2. namespace hd\controllers;
  3. use biz\admin\classes\AdminClass;
  4. use biz\ghs\classes\GhsClass;
  5. use biz\notice\classes\NoticeClass;
  6. use biz\shop\classes\ShopClass;
  7. use biz\shop\classes\ShopExpressClass;
  8. use bizGhs\custom\classes\CustomClass;
  9. use bizGhs\express\services\DadaExpressServices;
  10. use bizGhs\order\classes\OrderClass;
  11. use bizHd\purchase\classes\PurchaseClass;
  12. use bizHd\purchase\services\PurchaseService;
  13. use bizGhs\product\classes\ProductClass;
  14. use bizHd\wx\classes\WxOpenClass;
  15. use common\components\dateUtil;
  16. use common\components\dict;
  17. use common\components\freight;
  18. use common\components\httpUtil;
  19. use common\components\noticeUtil;
  20. use Yii;
  21. use common\components\util;
  22. use biz\wx\classes\WxMessageClass;
  23. class PurchaseController extends BaseController
  24. {
  25. public $guestAccess = ['detail'];
  26. //生成采购单 ssh 2021.1.17
  27. public function actionCreateOrder()
  28. {
  29. $post = Yii::$app->request->post();
  30. //多颜色花材数据结转换
  31. $colorItem = $post['xj'] ?? [];
  32. $newXj = [];
  33. if (!empty($colorItem)) {
  34. $colorData = json_decode($colorItem, true);
  35. if (!empty($colorData) && is_array($colorData)) {
  36. foreach ($colorData as $colorList) {
  37. if (!empty($colorList)) {
  38. foreach ($colorList as $color) {
  39. $ptItemId = $color['ptItemId'];
  40. $newXj[$ptItemId][] = $color;
  41. }
  42. }
  43. }
  44. }
  45. }
  46. $post['xj'] = $newXj;
  47. $ghsId = $post['ghsId'] ?? 0;
  48. //供货商
  49. $ghsInfo = GhsClass::getById($ghsId);
  50. if (empty($ghsInfo)) {
  51. util::fail('没有找到供货商');
  52. }
  53. $ghsShopId = $ghsInfo['shopId'] ?? 0;
  54. if (isset($ghsInfo['mainId']) && !empty($ghsInfo['mainId']) && $ghsInfo['mainId'] == $ghsInfo['ownMainId']) {
  55. util::fail('不能向自己的批发店采购');
  56. }
  57. $shop = $this->shop;
  58. $pfShopId = $shop->pfShopId ?? 0;
  59. if (!empty($pfShopId)) {
  60. util::fail('请在批发店进行采购');
  61. }
  62. $connection = Yii::$app->db;//事务处理
  63. $transaction = $connection->beginTransaction();
  64. try {
  65. $post['book'] = $post['book'] ?? 0;
  66. $post['sjId'] = $this->sjId;
  67. $post['shopId'] = $this->shopId;
  68. $post['shopAdminId'] = $this->shopAdminId;
  69. $post['ghsId'] = $ghsId;
  70. $post['ghsName'] = $ghsInfo['name'] ?? '';
  71. $post['ghsMobile'] = $ghsInfo['mobile'] ?? '';
  72. $post['ghsAvatar'] = $ghsInfo['avatar'] ?? '';
  73. $post['ghsFullAddress'] = $ghsInfo['fullAddress'] ?? '';
  74. $customId = $ghsInfo['customId'] ?? 0;
  75. $post['customId'] = $customId;
  76. $shopAdmin = $this->shopAdmin ?? null;
  77. $name = $shopAdmin->name ?? '';
  78. $post['shopAdminName'] = $name;
  79. $post['mainId'] = $this->mainId;
  80. $product = $post['product'] ?? '';
  81. $productList = json_decode($product, true);
  82. //判断product数据是不是同个供货商的
  83. $ghsShopInfo = ShopClass::getById($ghsShopId, true);
  84. $ghsMainId = $ghsShopInfo->mainId ?? 0;
  85. $isOpen = ShopClass::isOpen($ghsShopInfo);
  86. $book = $post['book'] ?? 0;
  87. if ($isOpen == 0 && $book == 0) {
  88. util::fail('本店已休息,请选择其它门店');
  89. }
  90. if ($book == 1) {
  91. $sendTimeWant = isset($post['sendTimeWant']) && !empty($post['sendTimeWant']) ? $post['sendTimeWant'] : date("Y-m-d");
  92. $future = date("Y-m-d", strtotime('+2 day'));
  93. if (strtotime($sendTimeWant) < strtotime($future)) {
  94. util::fail('请选择未来二天或更后时间');
  95. }
  96. $nowTime = strtotime(date("Y-m-d"));
  97. if (strtotime($sendTimeWant) < $nowTime) {
  98. util::fail('不能选择过去时间');
  99. }
  100. }
  101. $ids = array_unique(array_filter(array_column($productList, 'productId')));
  102. $productInfoList = productClass::getByIds($ids, null, 'id');
  103. if (!empty($productInfoList)) {
  104. $presellData = [];
  105. $nowTime = strtotime(date("Y-m-d"));
  106. foreach ($productInfoList as $currentInfo) {
  107. if (isset($currentInfo['mainId']) == false || $currentInfo['mainId'] != $ghsMainId) {
  108. util::fail('只能选择同一家的商品哦');
  109. }
  110. $currentName = $currentInfo['name'] ?? '';
  111. $presell = $currentInfo['presell'] ?? 0;
  112. $presellData[] = $presell;
  113. if ($presell == 1) {
  114. if (isset($post['sendTimeWant']) == false || empty($post['sendTimeWant'])) {
  115. util::fail('有预售花材,请选择送花日期');
  116. }
  117. $sendTimeWant = $post['sendTimeWant'];
  118. if (strtotime($sendTimeWant) < $nowTime) {
  119. util::fail('不能选择过去时间');
  120. }
  121. $hasDate = $currentInfo['presellDateList'] ?? [];
  122. if (empty($hasDate)) {
  123. util::fail('预售日期有问题,请提醒门店');
  124. }
  125. if (in_array($sendTimeWant, $hasDate) == false) {
  126. util::fail('您填的送花时间不在预售范围,花材:' . $currentName);
  127. }
  128. }
  129. }
  130. if (count($productInfoList) != count($ids)) {
  131. util::fail('存在无效商品');
  132. }
  133. $presellData = array_unique($presellData);
  134. if (count($presellData) > 1) {
  135. util::fail('预售和非预售花材不能一起下单');
  136. }
  137. } else {
  138. util::fail('花材不存在');
  139. }
  140. //供货商预订单最低公斤数要求和每公斤服务费
  141. $ghsInfo['kiloFee'] = $ghsShopInfo->kiloFee ?? 0;
  142. $ghsInfo['miniKilo'] = $ghsShopInfo->miniKilo ?? 0;
  143. $post['product'] = $productList;
  144. $sendType = $post['sendType'] ?? 0;
  145. $sendCost = 0;
  146. if ($sendType == dict::getDict('sendType', 'thirdSend')) {
  147. $weight = 0;
  148. foreach ($productList as $itemData) {
  149. $currentWeight = $itemData['weight'] ?? 0;
  150. $weight = bcadd($currentWeight, $weight, 2);
  151. }
  152. $result = PurchaseClass::getDistanceFee($this->shop, $ghsShopInfo, $weight);
  153. $sendCost = $result['fee'] ?? 0;
  154. }
  155. $post['sendCost'] = $sendCost;
  156. //出车和发快递可以算打包费
  157. $packCost = 0;
  158. if ($sendType == dict::getDict('sendType', 'thirdSend') || $sendType == dict::getDict('sendType', 'carGet')) {
  159. $packCost = $ghsShopInfo->packCost ?? 0;
  160. }
  161. $post['packCost'] = $packCost;
  162. $respond = PurchaseService::createPurchase($post, $ghsInfo);
  163. $transaction->commit();
  164. util::success($respond);
  165. } catch (Exception $e) {
  166. $transaction->rollBack();
  167. util::fail();
  168. }
  169. }
  170. //延期支付 ssh 2021.1.24
  171. public function actionDebtPay()
  172. {
  173. $get = Yii::$app->request->get();
  174. $orderSn = $get['orderSn'] ?? 0;
  175. $info = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
  176. PurchaseService::valid($info, $this->shopId);
  177. if ($info->status == 5) {
  178. util::fail('订单已取消');
  179. }
  180. if ($info->status != 1) {
  181. util::fail('订单不是待付款状态');
  182. }
  183. if ($info->book == 1) {
  184. util::fail('预售不能记欠款');
  185. }
  186. $ghsId = $info->ghsId;
  187. $ghs = GhsClass::getGhsInfo($ghsId);
  188. $customId = $ghs['customId'] ?? 0;
  189. $custom = CustomClass::getCustom($customId);
  190. if (empty($custom)) {
  191. util::fail('没有找到客户');
  192. }
  193. if (isset($custom['debt']) == false || $custom['debt'] == CustomClass::IS_DEBT_NO) {
  194. util::fail('您没有延期付款权限');
  195. }
  196. $connection = Yii::$app->db;//事务处理
  197. $transaction = $connection->beginTransaction();
  198. try {
  199. //延期支付
  200. PurchaseService::debt($info);
  201. $transaction->commit();
  202. //app新订单通知
  203. $saleId = $info->saleId ?? 0;
  204. $order = OrderClass::getById($saleId, true);
  205. if (!empty($order)) {
  206. $shopId = $order->shopId ?? 0;
  207. $shop = ShopClass::getById($shopId, true);
  208. if (!empty($shop)) {
  209. WxMessageClass::ghsHasNewOrderInform($shop, $order);
  210. }
  211. //订单生成时唤起在线打印
  212. if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {
  213. OrderClass::onlinePrint($order);
  214. $order->printNum += 1;
  215. $order->save();
  216. }
  217. //花店采购供货商端收到通知
  218. NoticeClass::ghsNewOrderNotice($order);
  219. }
  220. } catch (Exception $e) {
  221. $transaction->rollBack();
  222. util::fail('支付失败');
  223. }
  224. util::success($info->attributes);
  225. }
  226. //余额支付 ssh 2021.1.24
  227. public function actionBalancePay()
  228. {
  229. $shopAdmin = $this->shopAdmin;
  230. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  231. util::fail('超管才能操作');
  232. }
  233. $get = Yii::$app->request->get();
  234. $orderSn = $get['orderSn'] ?? 0;
  235. $password = $get['password'] ?? '';
  236. // 重新获取,不加密的用户数据
  237. $admin = AdminClass::getById($this->adminId, true);
  238. if (password_verify($password, $admin->payPassword) == false) {
  239. util::fail('密码错误');
  240. }
  241. $info = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
  242. if (empty($info)) {
  243. util::fail('没有找到采购单');
  244. }
  245. if ($info->status == 5) {
  246. util::fail('订单已取消');
  247. }
  248. if ($info->status != 1) {
  249. util::fail('订单不是待付款状态');
  250. }
  251. PurchaseService::valid($info, $this->shopId);
  252. $connection = Yii::$app->db;//事务处理
  253. $transaction = $connection->beginTransaction();
  254. try {
  255. //余额支付
  256. purchaseService::balancePay($info);
  257. $transaction->commit();
  258. } catch (Exception $e) {
  259. $transaction->rollBack();
  260. util::fail('支付失败');
  261. }
  262. util::success($info->attributes);
  263. }
  264. //采购记录 ssh 2021.1.24
  265. public function actionList()
  266. {
  267. $get = Yii::$app->request->get();
  268. $where = ['shopId' => $this->shopId];
  269. $status = $get['status'] ?? 0;
  270. if (!empty($status)) {
  271. $where['status'] = $status;
  272. }
  273. $respond = PurchaseService::getPurchaseList($where);
  274. $respond['shop'] = $this->shop->attributes;
  275. util::success($respond);
  276. }
  277. //采购详情 ssh 2021.01.25
  278. public function actionDetail()
  279. {
  280. $get = Yii::$app->request->get();
  281. $id = $get['id'] ?? 0;
  282. $info = PurchaseService::getInfo($id, true, true);
  283. if (isset($info['mainId']) == false || $info['mainId'] != $this->mainId) {
  284. //util::fail('没有权限访问');
  285. }
  286. $customId = $info['customId'] ?? 0;
  287. $custom = CustomClass::getById($customId);
  288. $hasDebtPay = $custom['debt'] ?? 0;
  289. $book = $info['book'] ?? 0;
  290. //预售不能记欠款
  291. if ($book == 1) {
  292. $hasDebtPay = 0;
  293. }
  294. $info['hasDebtPay'] = $hasDebtPay;
  295. $info['balance'] = $this->shop->balance ?? 0;
  296. util::success($info);
  297. }
  298. //可用的支付方式 ssh 2021.1.25
  299. public function actionPayWay()
  300. {
  301. $button = [
  302. ['type' => 'wxPay', 'show' => 1, 'disable' => 1],
  303. ['type' => 'debtPay', 'show' => 1, 'disable' => 0],
  304. ['type' => 'balancePay', 'show' => 1, 'disable' => 0],
  305. ];
  306. util::success(['button' => $button]);
  307. }
  308. //待结款明细 ssh 2021.1.26
  309. public function actionDebtList()
  310. {
  311. $get = Yii::$app->request->get();
  312. $id = $get['id'] ?? 0;
  313. $info = GhsClass::getGhsInfo($id);
  314. GhsClass::valid($info, $this->shopId);
  315. $where = ['ghsId' => $id, 'debt' => PurchaseClass::DEBT_YES];
  316. $searchTime = $get['searchTime'] ?? '';
  317. if (!empty($searchTime)) {
  318. $startTime = $get['startTime'] ?? '';
  319. $endTime = $get['endTime'] ?? '';
  320. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  321. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  322. }
  323. $respond = PurchaseService::getDebtList($where);
  324. util::success($respond);
  325. }
  326. //微信支付 ssh 2021.4.11
  327. public function actionWxPay()
  328. {
  329. ini_set('date.timezone', 'Asia/Shanghai');
  330. $post = Yii::$app->request->post();
  331. $couponId = $post['couponId'] ?? 0;
  332. $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
  333. $order = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
  334. if (empty($order)) {
  335. util::fail('订单号无效');
  336. }
  337. if ($order->status == 5) {
  338. util::fail('订单已取消');
  339. }
  340. if ($order->status != 1) {
  341. util::fail('订单不是待付款状态');
  342. }
  343. $id = $order->id;
  344. $order->changePrice = 2;
  345. $order->save();
  346. $deadline = $order->deadline;
  347. $current = time();
  348. if (($current + 50) > strtotime($deadline)) {
  349. util::fail('订单已失效,请重新下单');
  350. }
  351. $name = $orderSn;
  352. $totalFee = $order->realPrice;
  353. //强制使用小程序的miniOpenId
  354. $openId = isset($this->admin) && !empty($this->admin) ? $this->admin->miniOpenId : '';
  355. if (empty($openId)) {
  356. $currentShopId = $order->shopId ?? 0;
  357. $currentShop = ShopClass::getById($currentShopId, true);
  358. $currentShopName = $currentShop->merchantName . ' ' . $currentShop->shopName;
  359. $currentMobile = $currentShop->mobile ?? '';
  360. noticeUtil::push("花店采购时,发现没有openId,请跟进是否采购成功。{$currentShopName} {$currentMobile}", '15280215347');
  361. util::success(['hasError' => 1, 'hasNoMiniOpenId' => 1]);
  362. }
  363. $purchaseCapital = dict::getDict('capitalType', 'xhPurchase', 'id');
  364. //流水类型、优惠卷、微信支付(h5还是小程序支付)类型 带到回调
  365. $wxPayType = 0;
  366. if (httpUtil::isMiniProgram()) {
  367. $wxPayType = 1;
  368. }
  369. $attach = "couponId=" . $couponId . "&capitalType=" . $purchaseCapital . '&wxPayType=' . $wxPayType;
  370. //订单30分钟后过期
  371. $now = time();
  372. $expireTime = $now + 1800;
  373. $wx = Yii::getAlias("@vendor/weixin");
  374. require_once($wx . '/lib/WxPay.Api.php');
  375. require_once($wx . '/example/WxPay.JsApiPay.php');
  376. $input = new \WxPayUnifiedOrder();
  377. $input->SetBody($name);
  378. $input->SetOut_trade_no($orderSn);
  379. $input->SetTotal_fee($totalFee * 100);
  380. $input->SetTime_start(date("YmdHis", $now));
  381. //将流水类型、代金劵等传给微信再回传
  382. $input->SetAttach($attach);
  383. $input->SetTime_expire(date("YmdHis", $expireTime));
  384. $input->SetNotify_url(Yii::$app->params['hdHost'] . '/notice/wx-callback/');
  385. $input->SetTrade_type("JSAPI");
  386. //花卉宝代为申请的微信支付
  387. $merchantExtend = WxOpenClass::getWxInfo();
  388. if (isset($merchantExtend['wxPayApply']) && $merchantExtend['wxPayApply'] == 1) {
  389. $input->SetSub_openid($openId);
  390. } else {
  391. $input->SetOpenid($openId);
  392. }
  393. //强制使用小程序的miniAppId
  394. $merchantExtend['wxAppId'] = $merchantExtend['miniAppId'];
  395. $wxOrder = \WxPayApi::unifiedOrder($input, 6, $merchantExtend);
  396. $tools = new \JsApiPay();
  397. $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $merchantExtend);
  398. $newParams = json_decode($jsApiParameters, true);
  399. $newParams['id'] = $id;
  400. util::success($newParams);
  401. }
  402. //计算运费 ssh 20221003
  403. public function actionFreight()
  404. {
  405. $get = Yii::$app->request->get();
  406. $shop = $this->shop;
  407. $shopLat = isset($shop->lat) ? $shop->lat : '';
  408. $shopLong = isset($shop->long) ? $shop->long : '';
  409. if (empty($shopLat) || empty($shopLong)) {
  410. util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
  411. }
  412. $ghsId = $get['ghsId'] ?? 0;
  413. $ghs = GhsClass::getById($ghsId, true);
  414. if (empty($ghs)) {
  415. util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
  416. }
  417. $ghsShopId = $ghs->shopId ?? 0;
  418. $ghsShop = ShopClass::getById($ghsShopId, true);
  419. if (empty($ghsShop)) {
  420. util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
  421. }
  422. $ghsShopLat = isset($ghsShop->lat) ? $ghsShop->lat : '';
  423. $ghsShopLong = isset($ghsShop->long) ? $ghsShop->long : '';
  424. if (empty($ghsShopLat) || empty($ghsShopLong)) {
  425. util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
  426. }
  427. $weight = $get['weight'] ?? 0;
  428. if (empty($weight)) {
  429. util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
  430. }
  431. $respond = PurchaseClass::getDistanceFee($this->shop, $ghsShop, $weight);
  432. util::success($respond);
  433. }
  434. //运费计算 lqh 2021.4.12 暂时返回固定值
  435. public function actionFreight2()
  436. {
  437. //lqh 2021.6.25 运费固定返回0
  438. util::success(['sedCost' => 0]);
  439. $post = Yii::$app->request->post();
  440. $ghsId = $post['ghsId'] ?? 0;
  441. //供货商
  442. $ghsInfo = GhsClass::getById($ghsId);
  443. if (empty($ghsInfo)) {
  444. util::fail('没有找到供货商');
  445. }
  446. //花材信息
  447. $productJson = $post['product'] ?? '';
  448. // $productJson = '[{"productId":31993,"bigNum":1,"smallNum":0}]';
  449. if (empty($productJson)) {
  450. util::fail('请选择花材');
  451. }
  452. $productList = json_decode($productJson, true);
  453. if (empty($productList)) {
  454. util::fail('请选择花材');
  455. }
  456. $productList = PurchaseClass::mergeItemInfo($productList);
  457. $weight = 0;
  458. $price = 0;
  459. $productData = ProductClass::getProductMapData($productList);
  460. $bigNum = 0;
  461. foreach ($productList as $key => $val) {
  462. $productId = $val['productId'];
  463. $w = ProductClass::getWeight($val['productId'], $val['bigNum'], $val['smallNum']);
  464. $bigNum += $val['bigNum'];
  465. $weight = bcadd($w, $weight, 2);
  466. $ratio = $productData[$productId]['ratio'] ?? 0;
  467. //大小数量合并多少扎
  468. $itemNum = ProductClass::mergeItemNum($val['bigNum'], $val['smallNum'], $ratio);
  469. //售卖价格
  470. $itemPrice = $productData[$productId]['price'] ?? 0;
  471. //合计价格
  472. $price = bcadd($price, bcmul($itemNum, $itemPrice, 2), 2);
  473. }
  474. $ghsShopId = $ghsInfo['shopId'] ?? 0;
  475. $ghsSjId = $ghsInfo['sjId'] ?? 0;
  476. $sendTime = $post['sendTime'] ?? '';
  477. if (!empty($sendTime)) {
  478. //配送时间不为空
  479. // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
  480. $sendTimeInt = strtotime($sendTime);
  481. $now = time();
  482. $diff = $sendTimeInt - $now;
  483. //因服务器写入时间,改为至少提前6分钟
  484. if ($diff <= 360) {
  485. util::fail('配送时间至少提前6分钟');
  486. }
  487. $sendTime = date('Y-m-d H:i', strtotime($sendTime));
  488. } else {
  489. $sendTime = date('Y-m-d H:i', strtotime("+30 minute"));
  490. }
  491. //找供货商的客户信息,用里面的配送相关地址信息
  492. $customId = $ghsInfo['customId'] ?? 0;
  493. $customInfo = CustomClass::getById($customId);
  494. if (empty($customInfo)) {
  495. util::fail('没有找到客户');
  496. }
  497. //判断商家是否开启达达,若未开启,则使用自定义运费计算
  498. $shopNo = ShopExpressClass::getShopNo($ghsSjId, $ghsShopId);
  499. if (!$shopNo) {
  500. //使用自定义运费
  501. //util::fail('供货商暂未开通配送');
  502. $cost = freight::getCost($ghsInfo['lat'], $ghsInfo['long'], $customInfo['lat'], $customInfo['long'], $weight);
  503. util::success(['sedCost' => $cost]);
  504. }
  505. //组装订单信息
  506. $info = [];
  507. //发送放的商家信息,即供货商的相关信息
  508. $info['sjId'] = $ghsSjId;
  509. $info['shopId'] = $ghsShopId;
  510. $info['actPrice'] = $price;//价格
  511. $info['weight'] = $weight;
  512. $info['orderSn'] = \common\components\orderSn::getGhsOrderSn();
  513. $info['bigNum'] = $bigNum;
  514. //配送地址,当前零售端的门店地址
  515. $info['customName'] = $customInfo['name'] ?? '';
  516. $info['customMobile'] = $customInfo['mobile'] ?? '';
  517. $info['province'] = $customInfo['province'] ?? '';
  518. $info['city'] = $customInfo['city'] ?? '';;
  519. $info['address'] = $customInfo['address'] ?? '';;
  520. $info['floor'] = $customInfo['floor'] ?? '';;
  521. $info['fullAddress'] = $customInfo['fullAddress'] ?? '';;
  522. $info['lat'] = $customInfo['lat'] ?? '';;
  523. $info['long'] = $customInfo['long'] ?? '';;
  524. $info['sendTime'] = $sendTime;
  525. $res = DadaExpressServices::queryDeliverFee($info);
  526. util::success(['sedCost' => $res['fee']]);
  527. }
  528. }