index.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { connect } from 'herculex';
  2. Component(connect({
  3. mapStateToProps: {
  4. globalCar: state => state.$global.globalCar || []
  5. }
  6. })({
  7. props: {
  8. componentData: {},
  9. position: 'absolute',
  10. discountShow: true,
  11. selectNum: 0,
  12. onConfirmClick: () => null,
  13. onCarClick: () => null,
  14. buttonText: '去结算',
  15. showIcon: true,
  16. showTip: false,
  17. totalPrice: '',
  18. disCountTotalPrice: '',
  19. packingFee: 0,
  20. showColorBtn: true,
  21. // 是否为确认按钮
  22. isConfirm: false,
  23. item: null,
  24. showColorCar: true,
  25. startDeliveryAmount: 0
  26. },
  27. data: {
  28. btnConfig: [{
  29. text: '我知道了',
  30. extClass: 'confirm',
  31. type: 'confirm'
  32. }],
  33. inActiveCarIcon: 'https://gw.alipayobjects.com/mdn/rms_0e8a29/afts/img/A*JCnoQ6bVRA4AAAAAAAAAAAAAARQnAQ',
  34. carIconAddress: 'https://gw.alipayobjects.com/mdn/rms_0e8a29/afts/img/A*1vZdQLgoYLIAAAAAAAAAAAAAARQnAQ'
  35. },
  36. didMount() {},
  37. didUpdate() {},
  38. methods: {
  39. showModal() {
  40. const {
  41. startDeliveryAmount
  42. } = this.props;
  43. const {
  44. disCountTotalPrice,
  45. deliveryPackingFee
  46. } = this.data.globalCar;
  47. my.alert({
  48. title: '起送说明',
  49. content: `购物车商品${disCountTotalPrice}元,打包费${deliveryPackingFee}元,起送金额为${startDeliveryAmount}元`,
  50. buttonText: '我知道了'
  51. });
  52. },
  53. onHandleClick(e) {
  54. const {
  55. formId = ''
  56. } = e.detail;
  57. const {
  58. isConfirm
  59. } = this.props;
  60. if (isConfirm) {
  61. return this.props.onConfirmClick(formId);
  62. }
  63. const {
  64. carts: carList = []
  65. } = this.data.globalCar;
  66. const carCheckedList = carList.filter(v => v.checkedState === 'Y' && v.status === 'Y');
  67. if (!carCheckedList.length) {
  68. return;
  69. }
  70. this.props.onConfirmClick();
  71. },
  72. openCarPop() {
  73. this.props.onCarClick();
  74. }
  75. }
  76. }));