JoinGroupBuyForm.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace mall\models\groupBuy;
  3. use mall\models\BaseForm;
  4. /**
  5. * 参团下单表单校验
  6. * 结算页提交:校验拼团、数量、配送方式及收货信息(与开团字段对齐)
  7. * 跑腿字段与混合单 create-mix-order 对齐,供后端按同一套规则重算运费
  8. */
  9. class JoinGroupBuyForm extends BaseForm
  10. {
  11. public $groupBuyId;
  12. public $goodsNum;
  13. public $sendType;
  14. public $account;
  15. public $receiveUserName;
  16. public $receiveMobile;
  17. public $address;
  18. public $floor;
  19. public $city;
  20. public $dist;
  21. public $province;
  22. public $long;
  23. public $lat;
  24. public $showAddress;
  25. public $remark;
  26. public $reachDate;
  27. public $reachPeriod;
  28. public $bookMobile;
  29. public $needCard;
  30. public $cardInfo;
  31. public $anonymity;
  32. /** 跑腿平台标识,如 shansong/didi;后端报价用,不信任前端金额 */
  33. public $deliveryPlatform;
  34. /** 跑腿平台多报价识别 id(货拉拉车型、滴滴括号内容等) */
  35. public $deliveryBracketContent;
  36. public function rules()
  37. {
  38. return [
  39. ['groupBuyId', 'required', 'message' => '请选择拼团'],
  40. ['groupBuyId', 'integer', 'min' => 1, 'message' => '拼团无效'],
  41. ['goodsNum', 'default', 'value' => 1],
  42. ['goodsNum', 'integer', 'min' => 1, 'max' => 99, 'message' => '购买数量无效'],
  43. ['sendType', 'default', 'value' => 1],
  44. ['sendType', 'integer', 'min' => 0, 'max' => 4, 'message' => '配送方式无效', 'tooSmall' => '配送方式无效', 'tooBig' => '配送方式无效'],
  45. ['needCard', 'default', 'value' => 0],
  46. ['needCard', 'integer'],
  47. ['anonymity', 'default', 'value' => 0],
  48. ['anonymity', 'integer'],
  49. [['account', 'receiveUserName', 'receiveMobile', 'address', 'floor', 'city', 'dist', 'province', 'long', 'lat', 'showAddress', 'remark', 'reachDate', 'reachPeriod', 'bookMobile', 'cardInfo', 'deliveryPlatform', 'deliveryBracketContent'], 'safe'],
  50. ];
  51. }
  52. public function attributeLabels()
  53. {
  54. return [
  55. 'groupBuyId' => '拼团',
  56. 'goodsNum' => '数量',
  57. 'sendType' => '配送方式',
  58. 'deliveryPlatform' => '跑腿平台',
  59. 'deliveryBracketContent' => '跑腿报价标识',
  60. ];
  61. }
  62. }