You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
6.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="group tw-mb-[20px]">
  3. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[156px_200px_auto] xl:tw-grid-cols-[156px_200px_auto] tw-gap-[10px]">
  4. <div class="tw-flex tw-items-center">
  5. <label class="tw-font-normal tw-mb-[10px] md:tw-mb-0 t14 md:t16">
  6. <span>{{ $t("Place of delivery")}}
  7. <span class="required t12 md:t14">*</span></span>
  8. </label>
  9. </div>
  10. <elementSelectNew
  11. :select="{
  12. id: 'address1',
  13. label: '',
  14. required: true,
  15. }"
  16. :isRow="true"
  17. :itemsCenter="true"
  18. :labelWidth="0"
  19. :selectWidth="200"
  20. :selectList="selectAddressList"
  21. :default="formData.address1"
  22. :validation="validation.address1"
  23. @change="updateAddress($event)"
  24. ></elementSelectNew>
  25. <elementInputNew
  26. :input="{
  27. id: 'address2',
  28. required: true,
  29. type: 'text',
  30. placeholder: ''
  31. }"
  32. :maxlength="500"
  33. :validation="validation.address2"
  34. @change="formData.address2 = $event"
  35. >
  36. </elementInputNew>
  37. </div>
  38. <div class="element tw-my-[16px]">
  39. <div class="md:tw-flex tw-items-center">
  40. <label class="tw-block tw-mb-[20px] md:tw-mb-0 md:tw-mr-[10px] tw-min-w-[156px] t14 md:t16"><span>{{ $t('Date of delivery') }}
  41. <span class="required t12 md:t14">*</span></span></label>
  42. <selectDate @selected="selecteDateTime($event)"></selectDate>
  43. <span v-if="validation.select_date==false" class="required md:tw-ml-[20px] t12 md:t14">{{ $t("Required.") }}</span>
  44. </div>
  45. </div>
  46. <div class="md:tw-flex tw-flex-col">
  47. <label class="tw-block tw-mb-[20px] md:tw-mr-[10px] tw-min-w-[156px] t14 md:t16"><span>{{ $t('Time of delivery') }}
  48. <span class="required t12 md:t14">*</span></span>
  49. <span v-if="validation.delivery_type==false" class="required md:tw-ml-[20px] t12 md:t14">{{ $t("Required.") }}</span>
  50. </label>
  51. <div class="element tw-flex tw-items-center">
  52. <input
  53. id="Delivered1"
  54. type="radio"
  55. value="1"
  56. v-model="method"
  57. @change="selectRadio()"
  58. />
  59. <label for="Delivered1" class=" tw-font-normal t14 md:t16"
  60. ><span>{{ $t("Delivered to the exhibition hall on the same day") }}</span></label
  61. >
  62. </div>
  63. <div class="element md:tw-flex tw-items-center tw-mt-[15px]">
  64. <div class="tw-flex tw-items-center">
  65. <input
  66. id="Delivered2"
  67. type="radio"
  68. value="2"
  69. v-model="method"
  70. @change="selectRadio()"
  71. />
  72. <label for="Delivered2" class="t14 md:t16 tw-font-normal"
  73. ><span>{{ $t("Delivered to the exhibition site next day") }}</span></label
  74. >
  75. </div>
  76. <div class="tw-flex tw-ml-[35px] tw-mt-[5px] md:tw-ml-[20px] md:tw-mt-[0px]"><v-img max-width="20" :src="require('@/assets/svg/tip.svg')"></v-img><span class="tw-ml-[5px]">{{ $t("Must pay extra pressing fee") }}</span></div>
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import elementSelectNew from "@/components/newComponent/form/ElementSelectNew";
  83. import elementInputNew from "@/components/newComponent/form/ElementInputNew";
  84. import selectDate from "@/components/service/content/selectDate";
  85. import is from "is_js";
  86. export default {
  87. components: {
  88. elementSelectNew,
  89. elementInputNew,
  90. selectDate,
  91. },
  92. props: {
  93. selectAddressList: {
  94. type: Array,
  95. },
  96. },
  97. data() {
  98. return {
  99. method: null,
  100. // selectDates: '',
  101. formData: {
  102. address1: "0",
  103. address2: "",
  104. delivery_type: "",
  105. select_date: "",
  106. },
  107. validation: {
  108. address1: true,
  109. address2: true,
  110. delivery_type: true,
  111. select_date: true,
  112. },
  113. errors: null,
  114. };
  115. },
  116. methods: {
  117. reset() {
  118. this.formData = {
  119. address1: "0",
  120. address2: "",
  121. delivery_type: "",
  122. select_date: "",
  123. };
  124. },
  125. validators() {
  126. if (is.empty(this.formData.address1) || this.formData.address1 =="0") {
  127. this.validation.address1 = false;
  128. } else {
  129. this.validation.address1 = true;
  130. }
  131. if (is.empty(this.formData.address2)) {
  132. this.validation.address2 = false;
  133. } else {
  134. this.validation.address2 = true;
  135. }
  136. if (is.empty(this.formData.delivery_type)) {
  137. this.validation.delivery_type = false;
  138. } else {
  139. this.validation.delivery_type = true;
  140. }
  141. if (is.empty(this.formData.select_date)) {
  142. this.validation.select_date = false;
  143. } else {
  144. this.validation.select_date = true;
  145. }
  146. this.errors = Object.entries(this.validation).filter(
  147. (e) => e[1] == false
  148. );
  149. if (this.errors.length > 0) {
  150. return false;
  151. } else {
  152. return true;
  153. }
  154. },
  155. selectRadio(){
  156. this.formData.delivery_type = this.method;
  157. this.validation.delivery_type = true;
  158. this.$emit("ChangeCosts",{type: 'address',value: this.formData});
  159. },
  160. selecteDateTime(value){
  161. if(is.empty(value)){
  162. this.validation.select_date = false;
  163. this.formData.select_date = "";
  164. }else{
  165. this.validation.select_date = true;
  166. this.formData.select_date = value;
  167. }
  168. this.$emit("ChangeCosts",{type: 'address',value: this.formData});
  169. },
  170. updateAddress(value){
  171. this.formData.address1 = value;
  172. this.$emit("ChangeCosts",{type: 'address',value: this.formData});
  173. }
  174. },
  175. };
  176. </script>
  177. <style lang="scss" scoped>
  178. select {
  179. -moz-appearance: none;
  180. /* Firefox */
  181. -webkit-appearance: none;
  182. /* Safari and Chrome */
  183. appearance: none;
  184. background-image: url("~/assets/svg/down-arrow.svg");
  185. background-size: 9px 6px;
  186. background-position: right 20px center;
  187. background-repeat: no-repeat;
  188. }
  189. </style>