PurchaseController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace shop\controllers;
  3. use biz\purchase\classes\PurchaseClass;
  4. use bizGhs\product\classes\ProductClass;
  5. use common\components\orderSn;
  6. use Yii;
  7. use common\components\util;
  8. class PurchaseController extends BaseController
  9. {
  10. //生成采购单 shish 2021.1.17
  11. public function actionCreateOrder()
  12. {
  13. $post = Yii::$app->request->post();
  14. $ghsShopId = $post['ghsShopId'] ?? 0;
  15. $post['shopId'] = $this->shopId;
  16. $product = $post['product'] ?? '';
  17. $productList = json_decode($product, true);
  18. //判断product数据是不是同个供货商的
  19. ProductClass::valid($productList, $ghsShopId);
  20. $post['product'] = $productList;
  21. $respond = PurchaseClass::addPurchase($post);
  22. $orderSn = $respond['orderSn'] ?? '';
  23. $actPrice = $respond['actPrice'] ?? '';
  24. $data = [
  25. 'orderSn' => $orderSn,
  26. 'actPrice' => $actPrice,
  27. 'hasBalancePay' => 1,
  28. 'hasPayPassword' => 0,
  29. 'hasDebtPay' => 1,
  30. ];
  31. util::success($data);
  32. }
  33. //延期支付 shish 2021.1.24
  34. public function actionDebtPay()
  35. {
  36. $get = Yii::$app->request->get();
  37. $id = $get['id'] ?? 0;
  38. $info = PurchaseClass::getInfo($id);
  39. PurchaseClass::valid($info, $this->shopId);
  40. PurchaseClass::debt($info);
  41. util::complete();
  42. }
  43. //余额支付 shish 2021.1.24
  44. public function actionBalancePay()
  45. {
  46. $get = Yii::$app->request->get();
  47. $id = $get['id'] ?? 0;
  48. $password = $get['password'] ?? '';
  49. $info = PurchaseClass::getInfo($id);
  50. PurchaseClass::valid($info, $this->shopId);
  51. purchaseClass::balancePay($info);
  52. util::complete();
  53. }
  54. }