shop_list.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="order_list" @click="listClick">
  3. <view class="shop_logo">
  4. <image
  5. :src="`../../static/shop/shop_${item.channel}.png`"
  6. class="img"
  7. ></image>
  8. </view>
  9. <view class="shop_title">{{ item.title }}</view>
  10. <view class="delete" @click.stop="deleteItem">
  11. <i class="icon-font icon-delete"></i>
  12. </view>
  13. </view>
  14. <Popup title="提醒" ref="popupRef" isClose>
  15. <template #content>
  16. <trans _t="您确定要从收藏中移除该店铺吗" />
  17. </template>
  18. <template #footer>
  19. <view class="footer_btn">
  20. <view class="btn" @click="close">
  21. <trans _t="取消" />
  22. </view>
  23. <view class="btn del_btn" @click="submit">
  24. <trans _t="删除" />
  25. </view>
  26. </view>
  27. </template>
  28. </Popup>
  29. </template>
  30. <script setup>
  31. import { SHOP_USER_COLLECT } from "@/api";
  32. import { Toast } from "@/utils";
  33. import Popup from "@/components/popup";
  34. import { ref, nextTick } from "vue";
  35. const popupRef = ref(null);
  36. const props = defineProps({
  37. item: {
  38. type: Object,
  39. default: () => ({}),
  40. },
  41. });
  42. const emit = defineEmits(["delete"]);
  43. const listClick = () => {
  44. uni.navigateTo({
  45. url: `/pages/shop/merchants?channel=${props.item.channel}&shop_id=${props.item.shop_id}&seller_id=${props.item.seller_id}&title=${props.item.title}`,
  46. });
  47. };
  48. const deleteItem = () => {
  49. popupRef.value && popupRef.value.open();
  50. };
  51. const submit = () => {
  52. setCollect({
  53. channel: props.item.channel,
  54. type: "shop",
  55. shop_id: props.item.shop_id,
  56. seller_id: props.item.seller_id,
  57. title: props.item.title,
  58. price: props.item.price,
  59. pic_url: "",
  60. });
  61. };
  62. const setCollect = async (params) => {
  63. try {
  64. const res = await SHOP_USER_COLLECT(params);
  65. close();
  66. nextTick(() => {
  67. emit("delete", res);
  68. });
  69. } catch (error) {
  70. console.log(error);
  71. Toast(error.msg);
  72. }
  73. };
  74. const close = () => popupRef.value && popupRef.value.close();
  75. </script>
  76. <style lang="less" scoped>
  77. @import url("@/style.less");
  78. .order_list {
  79. border: var(--bor);
  80. padding: 24rpx;
  81. margin-top: 32rpx;
  82. border-radius: 16rpx;
  83. position: relative;
  84. .ver();
  85. .shop_logo {
  86. width: 200rpx;
  87. height: 200rpx;
  88. .img {
  89. width: inherit;
  90. height: inherit;
  91. display: block;
  92. }
  93. }
  94. .shop_title {
  95. flex: 1;
  96. color: var(--text);
  97. font-weight: 700;
  98. margin-left: 24rpx;
  99. margin-right: 40rpx;
  100. .size();
  101. }
  102. .delete {
  103. position: absolute;
  104. top: 36rpx;
  105. right: 24rpx;
  106. .icon-delete {
  107. color: var(--text-01);
  108. font-size: 36rpx;
  109. }
  110. }
  111. }
  112. .footer_btn {
  113. .ver();
  114. column-gap: 24rpx;
  115. .btn {
  116. flex: 1;
  117. border-radius: 16rpx;
  118. height: 38px;
  119. padding: 16rpx 30rpx;
  120. .flex_center();
  121. border: 1px solid var(--black);
  122. font-size: calc(28rpx);
  123. color: var(--black);
  124. }
  125. .del_btn {
  126. background-color: var(--black);
  127. color: var(--light);
  128. }
  129. }
  130. </style>