PurchaseController.php 23 KB

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