index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <div class="user-content mobile-content">
  3. <div class="user-name">
  4. <img src="/images/component/default.png"/>
  5. <div class="user-info">
  6. <p v-text="userInfo.data.userName"></p>
  7. <p v-text="enterpriseInfo.enName"></p>
  8. </div>
  9. <a>切换至卖家中心</a>
  10. </div>
  11. <ul class="switch-list">
  12. <li :class="{active: activeType == 'seek'}" @click="activeType = 'seek'">我的求购</li>
  13. <li :class="{active: activeType == 'comp'}" @click="activeType = 'comp'">器件收藏</li>
  14. <li :class="{active: activeType == 'store'}" @click="activeType = 'store'">店铺关注</li>
  15. </ul>
  16. <div class="seek" v-if="activeType == 'seek'">
  17. <ul class="seek-type">
  18. <li :class="{active: seekType == 'wait'}" @click="switchSeek('wait')"><div>待报价</div></li>
  19. <li :class="{active: seekType == 'done'}" @click="switchSeek('done')"><div>已报价</div></li>
  20. <li :class="{active: seekType == 'accept'}" @click="switchSeek('accept')"><div>已采纳</div></li>
  21. </ul>
  22. <div class="search-content">
  23. <input type="text" placeholder="请输入您要查找的型号或品牌">
  24. <span>
  25. <i class="iconfont icon-sousuo"></i>
  26. </span>
  27. </div>
  28. <seek-list></seek-list>
  29. </div>
  30. <div class="shop-list" v-if="activeType == 'store'" v-for="item in focusPage.content" @click="goStoreDetail(item.storeInfo.uuid)">
  31. <h3>{{item.storeName}}</h3>
  32. <div class="list-item">
  33. <div class="item-img">
  34. <img :src="getBackground(item.storeInfo.type)" />
  35. <img :src="item.storeInfo.logoUrl || '/images/component/default.png'">
  36. </div>
  37. <div class="list-item-phone">
  38. <p>电话:<span>{{item.storeInfo.enterprise.enTel}}</span></p>
  39. <p>传真:<span>{{item.storeInfo.enterprise.enFax}}</span></p>
  40. <p>联系商家:<a @click="selectStoreInfo(item, $event)">点击查看</a></p>
  41. <i class="iconfont icon-shoucang" @click="cancelFocus('store', item, $event)"></i>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="detail-brand" v-for="(item, index) in collectSave.content" v-if="activeType == 'comp'" @click="goComponentDetail(item.componentinfo.uuid)">
  46. <a>
  47. <div class="brand-item">
  48. <p>型号:<span>{{item.componentinfo.code}}</span></p>
  49. <p>品牌:<span>{{item.componentinfo.brand.nameCn}}</span></p>
  50. <p>产品描述:<span>{{item.componentinfo.kind.nameCn}}</span></p>
  51. <i class="iconfont icon-shoucang" @click="cancelFocus('product', item, $event)"></i>
  52. </div>
  53. </a>
  54. </div>
  55. <div class="none-state" v-if="(collectSave.totalElements == 0 && activeType == 'comp') || (focusPage.totalElements == 0 && activeType == 'store') || (collectSave.totalElements == 0 && focusPage.totalElements == 0)">
  56. <img src="/images/mobile/@2x/empty-collect.png">
  57. <p v-text="getRemindText()"></p>
  58. <nuxt-link to="/">返回首页</nuxt-link>
  59. </div>
  60. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  61. <div class="mobile-modal" v-if="showStoreInfo">
  62. <div class="mobile-modal-box">
  63. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  64. <div class="mobile-modal-content">
  65. <div v-if="checkInfo(storeInfo.enAddress || storeInfo.address)">商家地址:{{storeInfo.enAddress || storeInfo.address}}</div>
  66. <!--<div class="content-line link-url">在线咨询</div>-->
  67. <div v-if="checkInfo(storeInfo.enTel)">致电:<a :href="'tel:' + storeInfo.enTel" target="_blank" class="content-line link-url">{{storeInfo.enTel}}</a></div>
  68. <div v-if="checkInfo(storeInfo.enEmail)">邮件:<a :href="'mailto:' + storeInfo.enEmail" target="_blank" class="content-line link-url">{{storeInfo.enEmail}}</a></div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import RemindBox from '~components/mobile/common/RemindBox.vue'
  76. import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
  77. export default {
  78. layout: 'mobile',
  79. data () {
  80. return {
  81. userName: '',
  82. count: '',
  83. page: '',
  84. type: '',
  85. activeType: 'seek',
  86. collectResult: '取消成功',
  87. timeoutCount: 0,
  88. showStoreInfo: false,
  89. storeInfo: {},
  90. seekType: 'wait'
  91. }
  92. },
  93. components: {
  94. RemindBox,
  95. SeekList
  96. },
  97. fetch ({ store }) {
  98. return Promise.all([
  99. store.dispatch('product/saveStores', { count: 100, page: 1, type: 'component' }),
  100. store.dispatch('shop/StoreFocusPage', { count: 100, page: 1 }),
  101. store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : store.state.option.user.data.userUU})
  102. ])
  103. },
  104. methods: {
  105. cancelFocus: function (type, item, event) {
  106. event.stopPropagation()
  107. if (type === 'store') {
  108. this.$http.post('/trade/storeFocus/delete/storeId', [item.storeid])
  109. .then(response => {
  110. this.$store.dispatch('shop/StoreFocusPage', { count: 100, page: 1 })
  111. this.timeoutCount++
  112. })
  113. } else {
  114. // /trade/collection/
  115. this.$http.delete('/trade/collection/' + item.id)
  116. .then(response => {
  117. this.$store.dispatch('product/saveStores', { count: 100, page: 1, type: 'component' })
  118. this.timeoutCount++
  119. })
  120. }
  121. },
  122. getBackground: function (type) {
  123. let url = ''
  124. if (type === 'AGENCY') {
  125. url += '/images/mobile/@2x/shop/agency.png'
  126. } else if (type === 'DISTRIBUTION') {
  127. url += '/images/mobile/@2x/shop/distribution.png'
  128. } else if (type === 'ORIGINAL_FACTORY') {
  129. url += '/images/mobile/@2x/shop/original_factory.png'
  130. } else if (type === 'CONSIGNMENT') {
  131. url = '/images/mobile/@2x/shop/consignment.png'
  132. }
  133. return url
  134. },
  135. goStoreDetail: function (uuid) {
  136. this.$router.push('/mobile/shop/' + uuid)
  137. },
  138. goComponentDetail: function (uuid) {
  139. this.$router.push('/mobile/brand/componentDetail/' + uuid)
  140. },
  141. getRemindText: function () {
  142. if (this.activeType === 'comp') {
  143. return '抱歉,暂无器件收藏'
  144. } else if (this.activeType === 'store') {
  145. return '抱歉,暂无店铺关注'
  146. }
  147. },
  148. selectStoreInfo: function (store, event) {
  149. event.stopPropagation()
  150. this.storeInfo = store.storeInfo.enterprise || {}
  151. this.showStoreInfo = true
  152. },
  153. checkInfo: function (str) {
  154. return str && str.trim() !== ''
  155. },
  156. switchSeek: function (type) {
  157. this.seekType = type
  158. if (type === 'wait') {
  159. this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
  160. } else if (type === 'done') {
  161. this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done'})
  162. } else {
  163. this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done'})
  164. }
  165. }
  166. },
  167. computed: {
  168. collectSave () {
  169. return this.$store.state.product.common.collectList.data
  170. },
  171. userInfo () {
  172. return this.$store.state.option.user
  173. },
  174. enterpriseInfo () {
  175. let ens = this.userInfo.data.enterprises
  176. // if (ens && ens.length) {
  177. // return ens.find(item => item.current) || {enName: this.userInfo.data.userName + '(个人账户)'}
  178. // } else {
  179. // return {enName: this.userInfo.data.userName + '(个人账户)'}
  180. // }
  181. if (ens && ens.length) {
  182. for (let i = 0; i < ens.length; i++) {
  183. if (ens[i].current) {
  184. return ens[i]
  185. }
  186. }
  187. }
  188. return {enName: this.userInfo.data.userName + '(个人账户)'}
  189. },
  190. focusPage () {
  191. return this.$store.state.shop.storeInfo.focusPage.data
  192. }
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. .user-content{
  198. margin-bottom: .98rem;
  199. .none-state{
  200. text-align: center;
  201. padding:1.5rem 0;
  202. background: #fff;
  203. margin-top:.1rem;
  204. width:100%;
  205. img{
  206. margin:0 auto;
  207. width: 4.08rem;
  208. height: 2.62rem;
  209. }
  210. p {
  211. font-size: .32rem;
  212. color: #999;
  213. margin: 1.19rem 0 0 0;
  214. }
  215. a {
  216. display: block;
  217. font-size: .28rem;
  218. color: #fff;
  219. width: 1.88rem;
  220. height: .54rem;
  221. line-height: .54rem;
  222. background: #418bf6;
  223. margin: .7rem auto 0;
  224. border-radius: .05rem;
  225. }
  226. }
  227. .user-name{
  228. padding:.14rem 0 .2rem .34rem;
  229. background:#fff;
  230. width:100%;
  231. position:relative;
  232. img{
  233. display: inline-block;
  234. width:1.25rem;
  235. height:1.25rem;
  236. border:.04rem solid #c5dbfc;
  237. border-radius: .05rem;
  238. vertical-align: middle;
  239. }
  240. .user-info {
  241. margin-left:.25rem;
  242. display: inline-block;
  243. vertical-align: middle;
  244. p{
  245. font-size:.3rem;
  246. margin:0;
  247. font-weight: bold;
  248. display: block;
  249. overflow: hidden;
  250. text-overflow: ellipsis;
  251. white-space: nowrap;
  252. width: 3.92rem;
  253. &:nth-child(2) {
  254. font-weight: normal;
  255. margin-top: .3rem;
  256. }
  257. }
  258. }
  259. > a {
  260. font-size: .24rem;
  261. position: absolute;
  262. top: .45rem;
  263. right: .1rem;
  264. color: #3f84f6;
  265. border: .01rem solid #3f84f6;
  266. border-radius: .2rem;
  267. padding: .06rem .12rem;
  268. }
  269. }
  270. .shop-list {
  271. background:#fff;
  272. border-bottom: .1rem solid #dfe2e4;
  273. padding: .14rem 0 .14rem 0;
  274. h3{
  275. font-size: .32rem;
  276. line-height: .4rem;
  277. margin: 0 0 0 .27rem;
  278. overflow: hidden;
  279. text-overflow: ellipsis;
  280. white-space: nowrap;
  281. padding-top: .1rem;
  282. position: relative;
  283. top: .1rem;
  284. }
  285. .list-item{
  286. width:6.77rem;
  287. margin-left:.39rem;
  288. .item-img{
  289. width:2.4rem;
  290. vertical-align: middle;
  291. display: inline-block;
  292. img{
  293. &:nth-child(2) {
  294. width:2.4rem;
  295. height:1.69rem;
  296. border: .04rem solid #eee;
  297. }
  298. &:nth-child(1) {
  299. position:absolute;
  300. width:.65rem;
  301. height:.33rem;
  302. }
  303. }
  304. }
  305. .list-item-phone{
  306. width:3.95rem;
  307. padding:.18rem 0;
  308. position:relative;
  309. display: inline-block;
  310. vertical-align: middle;
  311. margin-left: .26rem;
  312. p{
  313. font-size:.28rem;
  314. line-height: .67rem;
  315. margin:0;
  316. overflow: hidden;
  317. text-overflow: ellipsis;
  318. white-space: nowrap;
  319. width: 3.2rem;
  320. }
  321. i{
  322. display:block;
  323. position:absolute;
  324. top: -.06rem;
  325. right: -.18rem;
  326. font-size:.5rem;
  327. color:#ff7800;
  328. width: .6rem;
  329. height: .6rem;
  330. text-align: center;
  331. line-height: .6rem;
  332. }
  333. }
  334. }
  335. &:active {
  336. background: #e1e1e1;
  337. }
  338. }
  339. .detail-brand{
  340. background: #fff;
  341. width:100%;
  342. min-height:1.5rem;
  343. padding:.2rem 0;
  344. border-bottom: .1rem solid #dfe2e4;
  345. &:nth-child(1) {
  346. margin-top:.1rem;
  347. }
  348. .brand-item{
  349. width:7rem;
  350. margin:0 auto;
  351. border-radius:.1rem;
  352. background: #fff;
  353. padding:.2rem;
  354. position:relative;
  355. &:active{
  356. background: #e1e1e1;
  357. }
  358. p{
  359. font-size:.28rem;
  360. line-height:.4rem;
  361. color:#333;
  362. margin:0;
  363. }
  364. i{
  365. display:block;
  366. position:absolute;
  367. top:.2rem;
  368. right:.1rem;
  369. font-size:.5rem;
  370. color:#ff7800;
  371. width: .6rem;
  372. height: .6rem;
  373. line-height: .6rem;
  374. text-align: center;
  375. }
  376. }
  377. div.active{
  378. background: #d4d;
  379. }
  380. }
  381. .collect-list-type {
  382. background: #fff;
  383. border-bottom: .04rem solid #acacac;
  384. p {
  385. font-size: .32rem;
  386. margin: 0 0 0 .13rem;
  387. width: .92rem;
  388. text-align: center;
  389. line-height: .5rem;
  390. border-bottom: .06rem solid #418bf6;
  391. }
  392. }
  393. ul.switch-list {
  394. li {
  395. display: inline-block;
  396. width: 2.5rem;
  397. height: .63rem;
  398. line-height: .63rem;
  399. text-align: center;
  400. font-size: .28rem;
  401. color: #666;
  402. background: #fff;
  403. border: .01rem solid #b4b4b4;
  404. &.active {
  405. background: #0067e7;
  406. border: .01rem solid #0067e7;
  407. color: #fff;
  408. }
  409. &:first-child {
  410. border-left: none;
  411. }
  412. &:last-child {
  413. border-right: none;
  414. }
  415. }
  416. }
  417. .seek {
  418. ul.seek-type {
  419. margin-top: .06rem;
  420. li {
  421. font-size: .28rem;
  422. color: #666;
  423. display: inline-block;
  424. width: 2.5rem;
  425. text-align: center;
  426. div {
  427. width: 2rem;
  428. border-bottom: .04rem solid #c1c4c9;
  429. margin: 0 auto;
  430. height: .6rem;
  431. line-height: .6rem;
  432. }
  433. &.active {
  434. color: #3f84f6;
  435. div {
  436. border-color: #3f84f6;
  437. }
  438. }
  439. }
  440. }
  441. .search-content {
  442. text-align: center;
  443. input {
  444. margin: .25rem 0 0 0;
  445. }
  446. }
  447. }
  448. }
  449. </style>