index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <script lang='ts' setup>
  2. import { useCart } from './useCart'
  3. import { numberToTwoDecimals } from '~/utils/number'
  4. import { ConstKeys } from '~/enums/const-enums'
  5. const { checkAll, isIndeterminate, submitLoading, selectedCount, handleChange, removeCart, submitOrder, checkedCart, cartList, orderTotal, getCartList, handleCheckAllChange, handleCheckedChange } = useCart()
  6. const router = useRouter()
  7. useHead({
  8. title: 'EJET Selection Retailer | Add to Cart',
  9. meta: [
  10. {
  11. name: 'description',
  12. content:
  13. `Review your selected wholesale products and proceed to submit your wish order. Manage your cart easily with EJET Selection and enjoy wholesale prices.`,
  14. },
  15. {
  16. property: 'og:title',
  17. content: 'EJET Selection Retailer | Add to Cart',
  18. },
  19. {
  20. property: 'og:description',
  21. content:
  22. `Review your selected wholesale products and proceed to submit your wish order. Manage your cart easily with EJET Selection and enjoy wholesale prices.`,
  23. },
  24. {
  25. property: 'og:type',
  26. content: 'website',
  27. },
  28. {
  29. property: 'twitter:title',
  30. content: 'EJET Selection Retailer | Add to Cart',
  31. },
  32. {
  33. property: 'twitter:description',
  34. content:
  35. `Review your selected wholesale products and proceed to submit your wish order. Manage your cart easily with EJET Selection and enjoy wholesale prices.`,
  36. },
  37. {
  38. property: 'twitter:card',
  39. content: 'summary_large_image',
  40. },
  41. ],
  42. link: [
  43. {
  44. rel: 'canonical',
  45. href: `${ConstKeys.DOMAINPRO}/cart`,
  46. },
  47. ],
  48. })
  49. function onClick(item: any) {
  50. router.push(`/brand/${item.brandId}`)
  51. }
  52. function onClickProduct(item: any) {
  53. router.push(`/product/${item.merchandiseId}`)
  54. }
  55. getCartList()
  56. </script>
  57. <template>
  58. <div>
  59. <div class="w-1400px mx-auto">
  60. <div class="pt-40px pb-20px flex items-center">
  61. <h2 class="mr-10px text-24px fw-500 text-#333333">
  62. Cart
  63. </h2>
  64. <div class="text-#666666">
  65. ({{ selectedCount }} products)
  66. </div>
  67. </div>
  68. <div v-if="cartList.length">
  69. <el-checkbox
  70. v-model="checkAll"
  71. :indeterminate="isIndeterminate"
  72. class="mb-20px !text-#333333 custom-checkbox"
  73. @change="handleCheckAllChange"
  74. >
  75. Select all
  76. </el-checkbox>
  77. <div>
  78. <div class="cart-header py-30px px-42px flex text-#C58C64 text-20px fw-500 b-b-solid b-b-1px b-b-#EBEEF5">
  79. <div class="w-500px">
  80. Product
  81. </div>
  82. <div class="w-400px">
  83. Brand
  84. </div>
  85. <!-- <div class="w-215px">
  86. Quantity
  87. </div>
  88. <div class="w-140px">
  89. Unit Price
  90. </div> -->
  91. <div class="w-270px">
  92. Total
  93. </div>
  94. <div class="flex-1" />
  95. </div>
  96. <div />
  97. <el-checkbox-group
  98. v-model="checkedCart"
  99. @change="handleCheckedChange"
  100. >
  101. <el-checkbox v-for="item in cartList" :key="item.merchandiseId" :label="item.merchandiseId" :value="item.merchandiseId" class="custom-table-item pr-40px b-b-solid b-b-1px b-b-#EBEEF5">
  102. <div class="flex ml-24px py-20px items-center" @click.prevent>
  103. <div class="w-500px flex items-center">
  104. <img :src="(item.masterImage.split(','))[0]" alt="" class="w-100px h-100px object-cover" srcset="">
  105. <div class="ml-20px !w-300px !lh-20px">
  106. <div class=" text-#666666 text-ellipsis overflow-hidden cursor-pointer hover:underline" @click="onClickProduct(item)">
  107. {{ item.title }}
  108. </div>
  109. </div>
  110. </div>
  111. <div class="w-400px cursor-pointer" @click="onClick(item)">
  112. {{ item.brandName || '-' }}
  113. </div>
  114. <div class="w-270px">
  115. <el-input-number
  116. v-model="item.quantity"
  117. :disabled="item.disabled"
  118. class="!w-120px"
  119. :min="item.moq"
  120. :max="100000"
  121. controls-position="right"
  122. size="large"
  123. @change="handleChange($event, item)"
  124. />
  125. </div>
  126. <!-- <div class="w-150px text-#C58C64">
  127. $ {{ item.price && item.price.toFixed(2) || 0 }}
  128. </div>
  129. <div class="w-270px text-#C58C64">
  130. $ {{ item.price * item.quantity ? numberToTwoDecimals(item.price * item.quantity) : 0 }}
  131. </div> -->
  132. <div class="flex-1" @click="removeCart(item)">
  133. <svgo-delete class="!w-24px !h-24px !fill-#999999 cursor-pointer" :filled="true" />
  134. </div>
  135. </div>
  136. </el-checkbox>
  137. </el-checkbox-group>
  138. </div>
  139. <div class="flex justify-end text-18px items-center mt-40px mb-120px !fw-500">
  140. <!-- <div class="mr-30px flex text-#36363D">
  141. Order Total:
  142. <div class="text-#C58C64 ml-10px">
  143. $ {{ numberToTwoDecimals(orderTotal) || 0 }}
  144. </div>
  145. </div> -->
  146. <el-button :disabled="!checkedCart.length" :loading="submitLoading" class="!bg-#C58C64 !text-#fff !w-250px !h-40px !b-rd-6px" @click="submitOrder">
  147. Submit Wish Order
  148. </el-button>
  149. </div>
  150. </div>
  151. <common-empty v-else class="my-200px" title="No goods found ~" />
  152. </div>
  153. <AppFooter />
  154. </div>
  155. </template>
  156. <style lang='less'>
  157. .custom-checkbox,.custom-table-item{
  158. cursor: auto;
  159. .el-checkbox__input{
  160. &.is-checked,&.is-indeterminate{
  161. color: #000!important;
  162. .el-checkbox__inner {
  163. color: #000 !important;
  164. background-color: #000 !important;
  165. border: 1px solid #000 !important;
  166. }
  167. }
  168. .el-checkbox__inner{
  169. width: 16px !important;
  170. height: 16px !important;
  171. &:after{
  172. left: 5px!important;
  173. top: 2px!important;
  174. }
  175. }
  176. }
  177. .el-checkbox__label{
  178. font-size: 16px !important;
  179. }
  180. &.is-checked,&.is-indeterminate {
  181. .el-checkbox__label {
  182. color: #000 !important;
  183. }
  184. }
  185. }
  186. .custom-table-item{
  187. height: unset!important;
  188. width: 100%!important;
  189. margin-right: unset!important;
  190. .el-checkbox__label{
  191. display: block;
  192. }
  193. &.is-checked,&.is-indeterminate{
  194. .el-checkbox__label {
  195. color: unset!important;
  196. }
  197. }
  198. }
  199. </style>