home.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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. definePageMeta({
  202. layout: "member",
  203. middleware: ["auth"],
  204. });
  205. // const L = lang_zn;
  206. const L = getCurLanguage();
  207. const router = useRouter();
  208. const memberInfoFromData = reactive({ info: {} });
  209. const looklog = reactive({ log: [] });
  210. const looklogLen = ref(0);
  211. const cartData = reactive({ data: [] });
  212. const cartLen = ref(0);
  213. const collectStore = reactive({ store: [] });
  214. const collectGoods = reactive({ goods: [] });
  215. const hotRecom = reactive({ goods: [] });
  216. const order = reactive({ list: [] });
  217. const { proxy } = getCurrentInstance();
  218. const dialogVisible = ref(false)
  219. const detailInfo = reactive({data:{}})
  220. //展示询盘详情
  221. const showDetail = (item) => {
  222. dialogVisible.value = true
  223. detailInfo.data = item
  224. }
  225. const getInitInfo = () => {
  226. //获取会员信息数据
  227. get("v3/member/front/member/getInfo").then((res) => {
  228. if (res.state == 200) {
  229. memberInfoFromData.info = res.data;
  230. }
  231. });
  232. };
  233. const getLookLog = () => {
  234. //获取我的足迹数据
  235. get("v3/member/front/productLookLog/list").then((res) => {
  236. if (res.state == 200) {
  237. looklog.log = res.data.list[0]? res.data.list[0].productLookLogInfoList.slice(0, 12): [];
  238. looklogLen.value = res.data.list[0]
  239. ? res.data.list[0].productLookLogInfoList.length
  240. : 0;
  241. }
  242. });
  243. };
  244. const params = reactive({
  245. current: 1,
  246. pageSize: 5,
  247. type: "",
  248. keyword: "",
  249. });
  250. const getCartItem = () => {
  251. get("v3/member/front/enquiry/list",params).then((res) => {
  252. if (res.state == 200) {
  253. cartData.data = res.data.list ? res.data.list : [];
  254. cartLen.value = res.data.pagination.total ? res.data.pagination.total : 0;
  255. }
  256. });
  257. };
  258. const getCollectStore = () => {
  259. get("v3/member/front/followStore/list").then((res) => {
  260. if (res.state == 200) {
  261. collectStore.store = res.data.storeList;
  262. }
  263. });
  264. };
  265. const getCollectGoods = () => {
  266. get("v3/member/front/followProduct/list").then((res) => {
  267. if (res.state == 200) {
  268. collectGoods.goods = res.data.list;
  269. }
  270. });
  271. };
  272. const getHotReco = () => {
  273. //获取热门推荐数据
  274. let params = {
  275. queryType: "cart",
  276. };
  277. get("v3/goods/front/goods/recommendList", params).then((res) => {
  278. if (res.state == 200) {
  279. hotRecom.goods = res.data.list;
  280. hotRecom.goods.map(
  281. (item) => (item.goodsPrice = new Number(item.goodsPrice).toFixed(2))
  282. );
  283. }
  284. });
  285. };
  286. const getOrder = () => {
  287. //获取订单
  288. let params = {
  289. current: 1,
  290. };
  291. get("v3/business/front/orderInfo/list", params).then((res) => {
  292. if (res.state == 200) {
  293. order.list = res.data.list;
  294. order.list.forEach((item) => {
  295. item.totalMoney = new Number(item.totalMoney).toFixed(2);
  296. item.productList = [];
  297. item.orderProductListVOList.forEach((items) => {
  298. if (items.isGift != 1) {
  299. item.productList.push(items);
  300. }
  301. });
  302. });
  303. }
  304. });
  305. };
  306. const seeOrderDetail = (orderSn) => {
  307. //去往订单详情
  308. let newWin = router.resolve({
  309. path: "order/detail",
  310. query: {
  311. orderSn: orderSn,
  312. },
  313. });
  314. window.open(newWin.href, "_blank");
  315. };
  316. onMounted(() => {
  317. nextTick(() => {
  318. getInitInfo();
  319. getLookLog();
  320. getHotReco();
  321. getOrder();
  322. getCartItem();
  323. getCollectStore();
  324. getCollectGoods();
  325. });
  326. });
  327. </script>
  328. <style lang="scss" scoped>
  329. @import "@/assets/style/member/index.scss";
  330. @import "@/assets/style/base.scss";
  331. .user_order_empty {
  332. padding: 90px;
  333. font-size: 12px;
  334. /*font-family: Microsoft YaHei;*/
  335. font-weight: 400;
  336. p {
  337. margin-left: 12px;
  338. color: #666666;
  339. }
  340. }
  341. .no_footprint {
  342. height: 73px;
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. font-size: 12px;
  347. /*font-family: Microsoft YaHei;*/
  348. font-weight: 400;
  349. color: #666666;
  350. }
  351. </style>