home.vue 12 KB

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