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.

358 lines
12 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
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
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="tw-mb-[20px] tw-rounded-[20px] tw-px-[20px] tw-py-[30px] tw-border tw-border-solid tw-border-slate-200">
  3. <div class="element collapse tw-my-[12px]">
  4. <div
  5. :class="[
  6. 'label',
  7. 'tw-cursor-pointer',
  8. 'service-info',
  9. show ? 'show' : 'hide',
  10. ]"
  11. @click="show = !show"
  12. >
  13. <div class="t-w-full tw-grid tw-grid-cols-[30px_auto_80px]">
  14. <div class="tw-w-[30px] tw-h-[30px] tw-rounded-[30px] tw-bg-black tw-text-white tw-flex tw-justify-center tw-items-center t14 md:t16">{{ sort }}</div>
  15. <div class="tw-flex tw-justify-center tw-items-center"><span class="tw-text-neutrals-600 tw-font-normal t14 md:t16">[{{ $t("Length") }} {{formData.length}}cm x {{ $t("Width") }} {{formData.width}}cm x {{ $t("Height") }} {{formData.height}}cm , {{ $t("Weight") }} {{ formData.weight }}kg] , {{ $t("Quantity") }}{{ formData.quantity }}</span></div>
  16. <v-img max-width="18" max-height="19" class="tw-ml-[10px]" @click="delService" :src="require('@/assets/svg/delete_default.svg')"></v-img>
  17. </div>
  18. </div>
  19. <Transition name="bounce">
  20. <div v-show="show">
  21. <div class="tw-pr-24 tw-mt-[20px]">
  22. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[122px_auto] xl:tw-grid-cols-[122px_auto] tw-gap-[10px]">
  23. <div class="tw-flex tw-items-center">
  24. <label class="tw-font-normal tw-mb-[10px] md:tw-mb-0 t14 md:t16">
  25. <span>{{ $t("Package")}}</span><span class="required t12 md:t14">*</span>
  26. </label>
  27. </div>
  28. <elementSelectNew
  29. :select="{
  30. id: 'Package',
  31. label: 'Package',
  32. required: true,
  33. }"
  34. :isRow="true"
  35. :itemsCenter="true"
  36. :labelWidth="0"
  37. :selectWidth="200"
  38. :selectList="selectPackageList"
  39. :default="formData.package"
  40. :validation="validation.package"
  41. @change="updatePackape($event)"
  42. ></elementSelectNew>
  43. </div>
  44. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[122px_auto_auto_auto] xl:tw-grid-cols-[122px_auto_auto_auto] tw-gap-[10px] tw-mt-[20px]">
  45. <div class="tw-flex tw-items-center">
  46. <label class="tw-font-normal tw-mb-[10px] md:tw-mb-0 t14 md:t16">
  47. <span>{{ $t("Size (cm)")}}</span><span class="required t12 md:t14">*</span>
  48. </label>
  49. </div>
  50. <elementInputNew
  51. :input="{
  52. id: 'Length',
  53. required: true,
  54. type: 'text',
  55. placeholder: 'Length',
  56. }"
  57. :maxlength="11"
  58. :validation="validation.length"
  59. @change="updateLength($event)"
  60. ></elementInputNew>
  61. <elementInputNew
  62. :input="{
  63. id: 'Width',
  64. required: true,
  65. type: 'text',
  66. placeholder: 'Width',
  67. }"
  68. :maxlength="11"
  69. :validation="validation.width"
  70. @change="updateWidth($event)"
  71. ></elementInputNew>
  72. <elementInputNew
  73. :input="{
  74. id: 'Height',
  75. required: true,
  76. type: 'text',
  77. placeholder: 'Height',
  78. }"
  79. :maxlength="11"
  80. :validation="validation.height"
  81. @change="updateHeight($event)"
  82. ></elementInputNew>
  83. </div>
  84. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-2 xl:tw-grid-cols-2 tw-gap-[10px] tw-mt-[20px]">
  85. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[122px_auto] xl:tw-grid-cols-[122px_auto] tw-gap-[10px]">
  86. <div class="tw-flex tw-items-center">
  87. <label class="tw-font-normal tw-mb-[10px] md:tw-mb-0 t14 md:t16">
  88. <span>{{ $t("Weight (kg)")}}</span><span class="required t12 md:t14">*</span>
  89. </label>
  90. </div>
  91. <elementInputNew
  92. :input="{
  93. id: 'Weight',
  94. required: true,
  95. type: 'text',
  96. placeholder: '',
  97. }"
  98. :maxlength="11"
  99. :validation="validation.weight"
  100. @change="updateWeight($event)"
  101. ></elementInputNew>
  102. </div>
  103. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[122px_auto] xl:tw-grid-cols-[122px_auto] tw-gap-[10px]">
  104. <div class="tw-flex tw-items-center md:tw-justify-end">
  105. <label class="tw-font-normal tw-mb-[10px] md:tw-mb-0 t14 md:t16">
  106. <span>{{ $t("Quantity")}}</span><span class="required t12 md:t14">*</span>
  107. </label>
  108. </div>
  109. <elementSelectNew
  110. :select="{
  111. id: 'Quantity',
  112. label: 'Quantity',
  113. required: true,
  114. }"
  115. :isRow="true"
  116. :itemsCenter="true"
  117. :labelWidth="0"
  118. :selectWidth="200"
  119. :selectList="selectQuantityList"
  120. :default="formData.quantity"
  121. :validation="validation.quantity"
  122. @change="updateQuantity($event)"
  123. ></elementSelectNew>
  124. </div>
  125. </div>
  126. <div class="tw-border-0 tw-border-b tw-border-solid tw-border-neutrals-200 tw-mt-[20px]"></div>
  127. <div class="group tw-mt-[20px]">
  128. <h3 class="t14 tw-font-bold tw-mb-[20px] md:t16">
  129. {{ $t("Service Type") }}<span class="required tw-font-normal t12 md:t14">*</span>&nbsp;({{ $t("Multiple choices") }})
  130. <span v-if="validation.typeShow==false" class="required md:tw-ml-[20px] tw-font-normal t12 md:t14">{{ $t("Required.") }}</span>
  131. </h3>
  132. <typeMultigroup :packages="typeGroupList" @type="changeType($event)"></typeMultigroup>
  133. </div>
  134. </div>
  135. </div>
  136. </Transition>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import elementSelectNew from "@/components/newComponent/form/ElementSelectNew";
  142. import elementInputNew from "@/components/newComponent/form/ElementInputNew";
  143. import typeMultigroup from "@/components/service/content/typeMultigroup.vue";
  144. import is from "is_js";
  145. import { IsNumber } from "~/utils/common";
  146. export default {
  147. name: 'selectExhibitionService',
  148. components: {
  149. elementSelectNew,
  150. elementInputNew,
  151. typeMultigroup
  152. },
  153. props: {
  154. selectPackageList: {
  155. type: Array,
  156. },
  157. selectLengthList: {
  158. type: Array,
  159. },
  160. selectWidthList: {
  161. type: Array,
  162. },
  163. selectHeightList: {
  164. type: Array,
  165. },
  166. selectQuantityList: {
  167. type: Array,
  168. },
  169. typeGroupList:{
  170. type: Array,
  171. },
  172. show: {
  173. type: Boolean,
  174. default: false,
  175. },
  176. sort:{
  177. type: Number,
  178. }
  179. },
  180. data() {
  181. return {
  182. typeLength: 0,
  183. // show: true,
  184. formData: {
  185. package: "0",
  186. selectPackape:{id: "0",name:""},
  187. length: "",
  188. width: "",
  189. height: "",
  190. weight: "",
  191. quantity: "0",
  192. selectServiceItems: [],
  193. },
  194. validation: {
  195. package: true,
  196. length: true,
  197. width: true,
  198. height: true,
  199. weight: true,
  200. quantity: true,
  201. typeShow: true,
  202. },
  203. errors: null,
  204. };
  205. },
  206. // watch: {
  207. // showServiceItem: {
  208. // handler: function () {
  209. // this.show = this.showServiceItem;
  210. // },
  211. // },
  212. // },
  213. methods: {
  214. validators() {
  215. if (is.empty(this.formData.package) || this.formData.package=="0") {
  216. this.validation.package = false;
  217. } else {
  218. this.validation.package = true;
  219. }
  220. if (is.empty(this.formData.length) || IsNumber(this.formData.length)==false) {
  221. this.validation.length = false;
  222. } else {
  223. this.validation.length = true;
  224. }
  225. if (is.empty(this.formData.width) || IsNumber(this.formData.width)==false) {
  226. this.validation.width = false;
  227. } else {
  228. this.validation.width = true;
  229. }
  230. if (is.empty(this.formData.height) || IsNumber(this.formData.height)==false) {
  231. this.validation.height = false;
  232. } else {
  233. this.validation.height = true;
  234. }
  235. if (is.empty(this.formData.weight) || IsNumber(this.formData.weight)==false) {
  236. this.validation.weight = false;
  237. } else {
  238. this.validation.weight = true;
  239. }
  240. if (is.empty(this.formData.quantity) || this.formData.quantity=="0") {
  241. this.validation.quantity = false;
  242. } else {
  243. this.validation.quantity = true;
  244. }
  245. if(this.typeLength<=0){
  246. this.validation.typeShow = false;
  247. }else{
  248. this.validation.typeShow = true;
  249. }
  250. this.errors = Object.entries(this.validation).filter(
  251. (e) => e[1] == false
  252. );
  253. if (this.errors.length > 0) {
  254. return false;
  255. } else {
  256. return true;
  257. }
  258. },
  259. changeType(serviceItems) {
  260. // this.validation.typeShow = serviceItems.length > 0 ? false : true;
  261. this.typeLength = serviceItems.length;
  262. this.formData.selectServiceItems = serviceItems;
  263. this.$emit("ChangeCosts",{type: 'stacker',value: this.formData});
  264. },
  265. delService(){
  266. this.$emit('delExhibitionService')//第一个参数是方法名,第二个为传递的参数
  267. },
  268. updateLength(value){
  269. this.formData.length = value;
  270. this.$emit("ChangeCosts",{type: 'stacker',value: this.formData});
  271. },
  272. updateWidth(value){
  273. this.formData.width = value;
  274. this.$emit("ChangeCosts",{type: 'stacker',value: this.formData});
  275. },
  276. updateHeight(value){
  277. this.formData.height = value;
  278. this.$emit("ChangeCosts",{type: 'stacker',value: this.formData});
  279. },
  280. updateWeight(value){
  281. this.formData.weight = value;
  282. this.$emit("ChangeCosts",{type: 'stacker',value: this.formData});
  283. },
  284. updateQuantity(value){
  285. this.formData.quantity = value;
  286. this.$emit("ChangeCosts",{type: 'stacker',value: this.formData});
  287. },
  288. updatePackape(value){
  289. if(this.selectPackageList.length>0){
  290. for(let i=0;i<this.selectPackageList.length;i++){
  291. if(this.selectPackageList[i].id == value){
  292. this.formData.selectPackape = this.selectPackageList[i];
  293. break;
  294. }
  295. }
  296. }
  297. this.formData.package = value;
  298. }
  299. },
  300. };
  301. </script>
  302. <style lang="scss" scoped>
  303. select {
  304. -moz-appearance: none;
  305. /* Firefox */
  306. -webkit-appearance: none;
  307. /* Safari and Chrome */
  308. appearance: none;
  309. background-image: url("~/assets/svg/down-arrow.svg");
  310. background-size: 9px 6px;
  311. background-position: right 20px center;
  312. background-repeat: no-repeat;
  313. }
  314. .service-info {
  315. position: relative;
  316. &::after {
  317. content: "";
  318. display: inline-block;
  319. position: absolute;
  320. right: 0;
  321. top: 5px;
  322. background-image: url("~/assets/svg/down-arrow.svg");
  323. background-size: 100%;
  324. background-position: right center;
  325. background-repeat: no-repeat;
  326. width: 16px;
  327. height: 10px;
  328. transition: all 0.2s linear;
  329. }
  330. &.show {
  331. &::after {
  332. transition: all 0.2s linear;
  333. transform: rotate(180deg);
  334. }
  335. }
  336. }
  337. .bounce-enter-active {
  338. animation: bounce-in 0.3s ease-out;
  339. }
  340. .bounce-leave-active {
  341. animation: bounce-in 0.3s cubic-bezier(1, 0.5, 0.8, 1) reverse;
  342. }
  343. @keyframes bounce-in {
  344. 0% {
  345. opacity: 0;
  346. transform: translateY(-10px);
  347. }
  348. 50% {
  349. opacity: 0.5;
  350. transform: translateY(-5px);
  351. }
  352. 100% {
  353. opacity: 1;
  354. transform: translateY(0);
  355. }
  356. }
  357. </style>