CreateGroupBuyForm.php 2.3 KB

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