chooseTypeModal.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <u-mask class="commonModal" :show="isShow" :mask-click-able="false">
  3. <view class="modal-con">
  4. <view class="modal-title">选择配送方式</view>
  5. <view class="modal-main">
  6. <u-radio-group v-model="form.dispatchType" width="50%" style="width: 100%;">
  7. <u-radio name="1">送货上门</u-radio>
  8. <u-radio name="2">快递到店</u-radio>
  9. </u-radio-group>
  10. <view style="padding: 20upx 0 16upx;">备注</view>
  11. <u-input v-model="form.remarks" placeholder="请输入出库备注(最多500字符)" type="textarea" :maxlength="500" :border="true" :auto-height="false" :custom-style="{height: '100upx'}" />
  12. </view>
  13. <view class="modal-footer">
  14. <view class="button-cancel" @click="isShow=false">取消</view>
  15. <view class="button-confirm" @click="handleConfirm">提交</view>
  16. </view>
  17. </view>
  18. </u-mask>
  19. </template>
  20. <script>
  21. export default {
  22. props: {
  23. openModal: { // 弹框显示状态
  24. type: Boolean,
  25. default: false
  26. }
  27. },
  28. data() {
  29. return {
  30. isShow: this.openModal, // 是否打开弹框
  31. form: {
  32. dispatchType: undefined,
  33. remarks: ''
  34. },
  35. }
  36. },
  37. methods: {
  38. // 确认
  39. handleConfirm(){
  40. const _this = this;
  41. // 表单校验
  42. if (!_this.form.dispatchType) {
  43. uni.showToast({ icon: 'none', title: '请选择配送方式' });
  44. return;
  45. }
  46. this.$emit('confirm', _this.form)
  47. }
  48. },
  49. watch: {
  50. // 父页面传过来的弹框状态
  51. openModal (newValue, oldValue) {
  52. this.isShow = newValue
  53. },
  54. // 重定义的弹框状态
  55. isShow (newValue, oldValue) {
  56. if (!newValue) {
  57. this.$emit('close')
  58. }
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .commonModal{
  65. width: 100%;
  66. height: 100%;
  67. position: absolute;
  68. left: 0;
  69. top: 0;
  70. z-index: 9999999;
  71. .modal-con{
  72. width: 78%;
  73. margin: 59% auto 0;
  74. background-color: #fff;
  75. border-radius: 24upx;
  76. .modal-title{
  77. text-align: center;
  78. font-size: 30upx;
  79. color: #000;
  80. padding: 30upx 30upx 0;
  81. }
  82. .modal-main{
  83. margin: 40upx 30upx 30upx;
  84. }
  85. .modal-footer{
  86. font-size: 30upx;
  87. display: flex;
  88. justify-content: space-between;
  89. align-items: center;
  90. text-align: center;
  91. border-top: 1upx solid #E5E5E5;
  92. .button-cancel{
  93. color: #999;
  94. border-right: 1upx solid #E5E5E5;
  95. flex-grow: 1;
  96. padding: 20upx 0;
  97. }
  98. .button-confirm{
  99. color: #2A86F4;
  100. flex-grow: 1;
  101. padding: 20upx 0;
  102. }
  103. }
  104. }
  105. }
  106. </style>