home.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <div class="sld_collect_index wd">
  3. <!-- 会员基本信息 -->
  4. <div class="user_info_top">
  5. <div class="infoCon clearfix">
  6. <div class="avatar">
  7. <img :src="memberInfoFromData.info.memberAvatar" class="head_img" />
  8. </div>
  9. <div class="info">
  10. <p>{{ L['会员名:'] }}: {{ memberInfoFromData.info.memberNickName }} ({{ contactType === 'email' ? memberInfoFromData.info.memberName : memberInfoFromData.info.memberMobile }})</p>
  11. <p v-if="contactType === 'email'">Email: {{memberInfoFromData.info.memberEmail}}</p>
  12. <p v-if="contactType === 'mobile'">联系方式: {{ memberInfoFromData.info.memberMobile }}</p>
  13. </div>
  14. </div>
  15. </div>
  16. <!-- 会员订单信息 -->
  17. <div class="user_order clearfix">
  18. <div class="my_follow ">
  19. <!-- 我的询盘item -->
  20. <div class="my_follow_item cartItem">
  21. <h4 class="user_title">
  22. <i class="iconfont"><img style="width:20px;position:relative;top:5px" src="/email.svg" /></i>{{ L["我的询盘"] }} ({{
  23. cartLen
  24. }})<router-link :to="'/member/enquiry/list'"
  25. >{{ L["查看更多"] }}></router-link
  26. >
  27. </h4>
  28. <ul class="clearfix">
  29. <template
  30. v-for="(item, storeIndex) in cartData.data"
  31. :key="storeIndex">
  32. <li class="list_item" @click="showDetail(item)">
  33. <p>
  34. {{storeIndex+1}}
  35. <i class="devider"></i>
  36. <span><b>{{L["发送时间"]}}:</b>{{item.createTime}}</span>
  37. <i class="devider"></i>
  38. <span class="message"><b>{{L["内容"]}}:</b>{{item.message.length > 80 ? item.message.slice(0,80) + '...' : item.message}}</span>
  39. </p>
  40. </li>
  41. </template>
  42. <li class="list_item" v-if="cartLen > 5">...</li>
  43. <div class="no_footprint" v-show="!cartLen">{{L["暂无询盘"]}}~</div>
  44. </ul>
  45. </div>
  46. <!-- 收藏商品item -->
  47. <div class="my_follow_item goods">
  48. <h4 class="user_title">
  49. <i class="iconfont">&#xe67d;</i>{{ L["我的收藏"] }} ({{
  50. memberInfoFromData.info.followProductNum
  51. }})
  52. <router-link :to="'/member/collect'" target="_blank"
  53. >{{ L["查看更多"] }}></router-link
  54. >
  55. </h4>
  56. <ul class="clearfix">
  57. <li
  58. class="list_item"
  59. v-for="({ productImage, productId,goodsName, state }, index) in collectGoods.goods"
  60. :key="index"
  61. >
  62. <router-link
  63. target="_blank"
  64. :to="'/goods/detail/'+ calcProductName(goodsName) +'_'+ productId"
  65. >
  66. <img :src="productImage" alt="" />
  67. <div class="mask" v-if="[5, 6].includes(state)">
  68. <div class="circle">{{ L['已下架'] }}</div>
  69. </div>
  70. </router-link>
  71. </li>
  72. <div class="no_footprint" v-show="!collectGoods.goods.length">
  73. {{L["暂无收藏商品"]}}~
  74. </div>
  75. </ul>
  76. </div>
  77. <!-- 关注店铺item -->
  78. <div class="my_follow_item store">
  79. <h4 class="user_title">
  80. <i class="iconfont">&#xe679;</i>{{ L["店铺收藏"] }} ({{
  81. memberInfoFromData.info.followStoreNum
  82. }})
  83. <router-link :to="'/member/collect?type=store'" target="_blank"
  84. >{{ L["查看更多"] }}></router-link
  85. >
  86. </h4>
  87. <ul class="clearfix">
  88. <li
  89. class="list_item"
  90. v-for="({ storeLogo, storeId, storeName }, index) in collectStore.store"
  91. :key="index"
  92. >
  93. <router-link :to="'/store/'+ calcProductName(storeName) +'_'+ storeId" target="_blank">
  94. <img :src="storeLogo" :alt="storeName" />
  95. </router-link>
  96. </li>
  97. <div class="no_footprint" v-show="!collectStore.store.length">
  98. {{L["暂无关注店铺"]}}~
  99. </div>
  100. </ul>
  101. </div>
  102. <!-- 足迹item -->
  103. <div class="my_follow_item footprint">
  104. <h4 class="user_title">
  105. <i class="iconfont">&#xe67f;</i>{{ L["我的足迹"] }} ({{
  106. looklog.log.length
  107. }})
  108. <router-link :to="'/member/footprint'" target="_blank"
  109. >{{ L["查看更多"] }}></router-link
  110. >
  111. </h4>
  112. <ul class="clearfix">
  113. <li
  114. class="list_item"
  115. v-for="({ goodsImage, productId,goodsName, state }, index) in looklog.log"
  116. :key="index"
  117. >
  118. <router-link
  119. target="_blank"
  120. :to="'/goods/detail/'+ calcProductName(goodsName) +'_'+ productId"
  121. >
  122. <img :src="goodsImage" alt="" />
  123. <div class="mask" v-if="[5, 6].includes(state)">
  124. <div class="circle">{{ L['已下架'] }}</div>
  125. </div>
  126. </router-link>
  127. </li>
  128. <div class="no_footprint" v-show="!looklog.log.length">
  129. {{L["暂无足迹"]}}~
  130. </div>
  131. </ul>
  132. </div>
  133. </div>
  134. </div>
  135. <!-- 热销推荐 -->
  136. <div class="user_hot_goods clearfix">
  137. <h3>{{ L["热销推荐"] }}</h3>
  138. <ul class="clearfix">
  139. <li
  140. v-for="(
  141. { goodsImage, goodsName, goodsPrice, defaultProductId,goodsMoney }, index
  142. ) in hotRecom.goods"
  143. :key="index"
  144. >
  145. <router-link
  146. target="_blank"
  147. :to="'/goods/detail/'+ calcProductName(goodsName) +'_'+ defaultProductId"
  148. >
  149. <div class="img">
  150. <img class="lazy" :src="goodsImage" alt="" />
  151. </div>
  152. <p class="hot_goods_name">{{ goodsName }}</p>
  153. <p class="hot_goods_price">
  154. <em> {{goodsMoney}}</em>
  155. </p>
  156. </router-link>
  157. </li>
  158. </ul>
  159. </div>
  160. <el-dialog v-model="dialogVisible" title="Detail" width="30%" lock-sroll="false">
  161. <el-form label-position="left" class="demo-table-expand">
  162. <el-form-item :label="L['姓名']+':'">
  163. <span>{{ detailInfo.data.name}}</span>
  164. </el-form-item>
  165. <el-form-item :label="L['邮箱']+':'">
  166. <span>{{ detailInfo.data.email}}</span>
  167. </el-form-item>
  168. <el-form-item :label="L['类型']+':'">
  169. <template v-if="detailInfo.data.itemType == 'GOODS'">
  170. <nuxt-link style="color:#00985e;text-decoration: underline;" :to="'/goods/detail/'+ calcProductName(detailInfo.data.itemName) +'_'+ detailInfo.data.itemId" target="_blank">{{detailInfo.data.itemName}}
  171. </nuxt-link>
  172. </template>
  173. <template v-if="detailInfo.data.itemType == 'SHOP'">
  174. <nuxt-link style="color:#00985e;text-decoration: underline;" :to="'/store/'+ calcProductName(detailInfo.data.itemName) +'_'+ detailInfo.data.storeId" target="_blank">{{detailInfo.data.itemName}}
  175. </nuxt-link>
  176. </template>
  177. <template v-if="detailInfo.data.itemType == 'MALL'">
  178. <nuxt-link style="color:#00985e;text-decoration: underline;" :to="`/home/contact`" target="_blank">{{detailInfo.data.itemTypeStr}}
  179. </nuxt-link>
  180. </template>
  181. </el-form-item>
  182. <el-form-item :label="L['采购数量']+':'">
  183. <template v-if="detailInfo.data.itemType == 'GOODS'">
  184. {{detailInfo.data.quantity}}
  185. </template>
  186. <template v-if="detailInfo.data.itemType != 'GOODS'">
  187. -
  188. </template>
  189. </el-form-item>
  190. <el-form-item :label="L['电话']+':'">
  191. <span>{{ detailInfo.data.phoneCode}}-{{detailInfo.data.phone}}</span>
  192. </el-form-item>
  193. <el-form-item :label="L['公司名称']+':'">
  194. <span>{{ detailInfo.data.company }}</span>
  195. </el-form-item>
  196. <el-form-item :label="L['内容']+':'">
  197. <span style="word-break: break-word;">{{ detailInfo.data.message }}</span>
  198. </el-form-item>
  199. </el-form>
  200. </el-dialog>
  201. </div>
  202. </template>
  203. <script setup>
  204. import { reactive, onMounted, getCurrentInstance, ref } from "vue";
  205. import { useRouter } from "vue-router";
  206. import { ElDialog,ElForm,ElFormItem } from "element-plus";
  207. import { getCurLanguage } from '@/composables/common.js';
  208. import { getContactType } from "@/utils/common"
  209. definePageMeta({
  210. layout: "member",
  211. middleware: ["auth"],
  212. });
  213. const contactType = getContactType();
  214. // const L = lang_zn;
  215. const L = getCurLanguage();
  216. const router = useRouter();
  217. const memberInfoFromData = reactive({ info: {} });
  218. const looklog = reactive({ log: [] });
  219. const looklogLen = ref(0);
  220. const cartData = reactive({ data: [] });
  221. const cartLen = ref(0);
  222. const collectStore = reactive({ store: [] });
  223. const collectGoods = reactive({ goods: [] });
  224. const hotRecom = reactive({ goods: [] });
  225. const order = reactive({ list: [] });
  226. const { proxy } = getCurrentInstance();
  227. const dialogVisible = ref(false)
  228. const detailInfo = reactive({data:{}})
  229. //展示询盘详情
  230. const showDetail = (item) => {
  231. dialogVisible.value = true
  232. detailInfo.data = item
  233. }
  234. const getInitInfo = () => {
  235. //获取会员信息数据
  236. get("v3/member/front/member/getInfo").then((res) => {
  237. if (res.state == 200) {
  238. memberInfoFromData.info = res.data;
  239. }
  240. });
  241. };
  242. const getLookLog = () => {
  243. //获取我的足迹数据
  244. get("v3/member/front/productLookLog/list").then((res) => {
  245. if (res.state == 200) {
  246. looklog.log = res.data.list[0]? res.data.list[0].productLookLogInfoList.slice(0, 12): [];
  247. looklogLen.value = res.data.list[0]
  248. ? res.data.list[0].productLookLogInfoList.length
  249. : 0;
  250. }
  251. });
  252. };
  253. const params = reactive({
  254. current: 1,
  255. pageSize: 5,
  256. type: "",
  257. keyword: "",
  258. });
  259. const getCartItem = () => {
  260. get("v3/member/front/enquiry/list",params).then((res) => {
  261. if (res.state == 200) {
  262. cartData.data = res.data.list ? res.data.list : [];
  263. cartLen.value = res.data.pagination.total ? res.data.pagination.total : 0;
  264. }
  265. });
  266. };
  267. const getCollectStore = () => {
  268. get("v3/member/front/followStore/list").then((res) => {
  269. if (res.state == 200) {
  270. collectStore.store = res.data.storeList;
  271. }
  272. });
  273. };
  274. const getCollectGoods = () => {
  275. get("v3/member/front/followProduct/list").then((res) => {
  276. if (res.state == 200) {
  277. collectGoods.goods = res.data.list;
  278. }
  279. });
  280. };
  281. const getHotReco = () => {
  282. //获取热门推荐数据
  283. let params = {
  284. queryType: "cart",
  285. };
  286. get("v3/goods/front/goods/recommendList", params).then((res) => {
  287. if (res.state == 200) {
  288. hotRecom.goods = res.data.list;
  289. hotRecom.goods.map(
  290. (item) => (item.goodsPrice = new Number(item.goodsPrice).toFixed(2))
  291. );
  292. }
  293. });
  294. };
  295. const getOrder = () => {
  296. //获取订单
  297. let params = {
  298. current: 1,
  299. };
  300. get("v3/business/front/orderInfo/list", params).then((res) => {
  301. if (res.state == 200) {
  302. order.list = res.data.list;
  303. order.list.forEach((item) => {
  304. item.totalMoney = new Number(item.totalMoney).toFixed(2);
  305. item.productList = [];
  306. item.orderProductListVOList.forEach((items) => {
  307. if (items.isGift != 1) {
  308. item.productList.push(items);
  309. }
  310. });
  311. });
  312. }
  313. });
  314. };
  315. const seeOrderDetail = (orderSn) => {
  316. //去往订单详情
  317. let newWin = router.resolve({
  318. path: "order/detail",
  319. query: {
  320. orderSn: orderSn,
  321. },
  322. });
  323. window.open(newWin.href, "_blank");
  324. };
  325. onMounted(() => {
  326. nextTick(() => {
  327. getInitInfo();
  328. getLookLog();
  329. getHotReco();
  330. getOrder();
  331. getCartItem();
  332. getCollectStore();
  333. getCollectGoods();
  334. });
  335. });
  336. </script>
  337. <style lang="scss" scoped>
  338. @import "@/assets/style/member/index.scss";
  339. @import "@/assets/style/base.scss";
  340. .user_order_empty {
  341. padding: 90px;
  342. font-size: 12px;
  343. /*font-family: Microsoft YaHei;*/
  344. font-weight: 400;
  345. p {
  346. margin-left: 12px;
  347. color: #666666;
  348. }
  349. }
  350. .no_footprint {
  351. height: 73px;
  352. display: flex;
  353. justify-content: center;
  354. align-items: center;
  355. font-size: 12px;
  356. /*font-family: Microsoft YaHei;*/
  357. font-weight: 400;
  358. color: #666666;
  359. }
  360. </style>