home.vue 12 KB

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