right.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. import { useUserStore } from '@/stores/modules/user'
  4. import { addShopCartApi } from '~/api/model/goods'
  5. const props = defineProps({
  6. data: {
  7. type: Object,
  8. default: () => ({}),
  9. },
  10. })
  11. const emit = defineEmits(['update:data', 'addToCart', 'inquire'])
  12. const userStore = useUserStore()
  13. const { isLogin } = storeToRefs(userStore)
  14. const { openLoginModal } = useLoginModal()
  15. const temporaryData = ref()
  16. const price = ref(0)
  17. const quantity = ref(0)
  18. watch(
  19. () => props.data,
  20. (data) => {
  21. temporaryData.value = JSON.parse(JSON.stringify(data))
  22. quantity.value = +data.moq
  23. price.value = +data.sellPrice
  24. // const timer = setTimeout(() => {
  25. // handlerData(quantity.value)
  26. // clearTimeout(timer)
  27. // }, 200)
  28. },
  29. {
  30. immediate: true,
  31. deep: true,
  32. },
  33. )
  34. async function onInquire() {
  35. try {
  36. const { status, isFirstLogin } = await openLoginModal()
  37. if (status) {
  38. emit('inquire')
  39. if (isFirstLogin)
  40. emit('update:data')
  41. }
  42. }
  43. catch (error) {
  44. console.log(error)
  45. }
  46. }
  47. const getLabelList = computed(() => {
  48. if (!props.data.tag_dictText)
  49. return []
  50. // 字符串转化为数组
  51. return props.data.tag_dictText.split(',')
  52. })
  53. </script>
  54. <template>
  55. <div class="flex-1">
  56. <div class="flex justify-between">
  57. <h1
  58. class="fw-700 text-30px w-510px lh-40px line-clamp-2 text-#363C40 custom-title-font"
  59. >
  60. {{ data.merchandiseEnglishName }}
  61. </h1>
  62. <common-favorite :data="data" w="34px" svg-size="18" />
  63. </div>
  64. <div v-if="getLabelList.length" class="flex gap-12px mt-20px">
  65. <div
  66. v-for="item in getLabelList"
  67. :key="item.id"
  68. class="bg-#8230F5 b-rd-6px text-#fff py-8px px-12px"
  69. >
  70. {{ item }}
  71. </div>
  72. </div>
  73. <div class="my-20px">
  74. <div v-if="isLogin" class="text-24px text-#C58C46 flex">
  75. <div class="fw-700 w-200px">
  76. Unit Price
  77. </div>
  78. <span class="cursor-pointer hover:underline fw-500 ml-40px" @click="onInquire">Go inquire</span>
  79. </div>
  80. <div
  81. v-else
  82. class="fw-500 text-24px underline my-20px text-#C58C64 cursor-pointer"
  83. @click="onInquire"
  84. >
  85. Inquire
  86. </div>
  87. </div>
  88. <div class="py-20px pb-40px">
  89. <div class="mb-25px flex">
  90. <div class="w-200px text-#666">
  91. Product Code
  92. </div>
  93. <div class="ml-40px text-#333">
  94. {{ data.billNo }}
  95. </div>
  96. </div>
  97. <div class="mb-25px flex">
  98. <div class="w-200px text-#666">
  99. Size
  100. </div>
  101. <div class="ml-40px text-#333">
  102. {{ data.size }} cm
  103. </div>
  104. </div>
  105. <div class="mb-25px flex">
  106. <div class="w-200px text-#666">
  107. Caton Size
  108. </div>
  109. <div class="ml-40px text-#333">
  110. {{ data.width }}cm * {{ data.height }}cm * {{ data.length }}cm
  111. </div>
  112. </div>
  113. <div class="mb-25px flex">
  114. <div class="w-200px text-#666">
  115. Material
  116. </div>
  117. <div class="ml-40px text-#333">
  118. others
  119. </div>
  120. </div>
  121. <div class="mb-25px flex">
  122. <div class="w-200px text-#666">
  123. Packaging Method
  124. </div>
  125. <div class="ml-40px text-#333">
  126. {{ data.packagingMethod }}
  127. </div>
  128. </div>
  129. <div class="mb-25px flex">
  130. <div class="w-200px text-#666">
  131. QTY/CTN
  132. </div>
  133. <div class="ml-40px text-#333">
  134. {{ data.cartonQuantity }}
  135. </div>
  136. </div>
  137. <div class="mb-25px flex">
  138. <div class="w-200px text-#666">
  139. Delivery Time
  140. </div>
  141. <div class="ml-40px text-#333">
  142. {{ data.deliveryTime }}
  143. </div>
  144. </div>
  145. <div class="flex items-center">
  146. <div class="w-200px text-#666">
  147. MOQ
  148. </div>
  149. <div class="ml-40px text-#333">
  150. {{ data.moq }} {{ data.unitCode_dictText }}
  151. <!-- <el-input-number
  152. :disabled="!isLogin"
  153. :model-value="quantity"
  154. class="!w-150px custom-input"
  155. :step="1"
  156. :min="data.moq"
  157. @change="changeQuantity"
  158. /> -->
  159. </div>
  160. </div>
  161. </div>
  162. <el-button
  163. plain
  164. class="!bg-#C58C46 !text-#fff !w-full !h-48px !text-16px !b-rd-6px"
  165. @click="emit('addToCart')"
  166. >
  167. <!-- Add to Cart (${{ quantity * price ? (quantity * price).toFixed(2) : 0 }}) -->
  168. Add to Cart
  169. </el-button>
  170. </div>
  171. </template>
  172. <style lang="less" scoped>
  173. .custom-input {
  174. height: 32px !important;
  175. border-radius: 2px;
  176. ::v-deep(.el-input-number__increase) {
  177. width: 36px !important;
  178. display: flex;
  179. justify-content: items-center;
  180. align-items: center;
  181. &:hover {
  182. color: #c58c64 !important;
  183. box-shadow: 0 0 0 1px #c58c64 inset !important;
  184. }
  185. }
  186. ::v-deep(.el-input-number__decrease) {
  187. width: 36px !important;
  188. display: flex;
  189. justify-content: items-center;
  190. align-items: center;
  191. &:hover {
  192. color: #c58c64 !important;
  193. box-shadow: 0 0 0 1px #c58c64 inset !important;
  194. }
  195. }
  196. }
  197. </style>