StoreInfo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <div class="storeInfo container">
  3. <div class="form-group">
  4. <div class="storeIns">
  5. <div class="sign">选择商家:</div>
  6. <div class="storeInList" v-for="storeIn in store">
  7. <div class="choose" :class="{'storeIn-active' : storeIn.isSelected, 'storeIn' : !storeIn.isSelected}" @click="store.length==1?'':addStore(storeIn)">
  8. <a class="storeLogo">
  9. <img :src="storeIn.logoUrl || '/images/component/default.png'" :alt="storeIn.storeName" :title="storeIn.storeName">
  10. </a>
  11. </div>
  12. </div>
  13. <div class="storeInList" style="font-size: 14px" v-if="!store || store.length == 0">
  14. 暂无商家信息
  15. </div>
  16. </div>
  17. </div>
  18. <div class="form-group" style="margin-bottom: 40px;">
  19. <div>
  20. <div style="font-size: 14px">
  21. <span>产品匹配:</span>
  22. <span v-if="store && store.length > 0">
  23. <input type="checkbox" v-if="storeExist && UmallExist" @click="filterType('umall')" :checked="!this.params.filter.ignoreUMall">
  24. <span v-if="UmallExist">&nbsp;库存寄售&nbsp;</span>
  25. <input type="checkbox" v-if="storeExist && UmallExist" @click="filterType('store')" :checked="!this.params.filter.ignoreStore">
  26. <span v-if="storeExist">&nbsp;店铺自营</span>
  27. </span>
  28. <span v-if="!store || store.length == 0">暂无可匹配的信息 </span>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="goodsList">
  33. <div class="flex">
  34. <div class="goods-item">按商家列表</div>
  35. <div class="flex_item"></div>
  36. <span>
  37. <button type="button" class="btn sendprove" @click="sendprove()">我要发布产品</button>
  38. </span>
  39. </div>
  40. <table class="table">
  41. <thead>
  42. <tr class="height54">
  43. <th class="text-center" width="160">型号</th>
  44. <th class="text-center" width="130">包装方式</th>
  45. <!--<th class="text-center" width="110">生产日期</th>-->
  46. <th class="text-center" width="170">库存</th>
  47. <th class="text-center" width="80">梯度/pcs</th>
  48. <th class="text-center" width="100">香港交货<span style="font-size: 12px;">($)</span></th>
  49. <th class="text-center" width="130">大陆交货<span style="font-size: 12px;">(¥)</span></th>
  50. <th class="text-center" width="110">交期<span style="font-size: 12px;">(天)</span></th>
  51. <th class="text-center" width="140">操作</th>
  52. </tr>
  53. </thead>
  54. <tbody class="text-center">
  55. <tr style="cursor: pointer;" v-for="list in storeList.content" @click="goProductDetail(list.batchCode)">
  56. <td style="position: relative">
  57. <img class="sellout-flag" v-if="list.status === 602" src="/images/search/sellout-search.png" alt="">
  58. <a v-if="list.code">{{list.code}}</a>
  59. <a v-if="!list.code">—</a>
  60. </td>
  61. <td>
  62. <a v-if="list.packaging">{{list.packaging}}</a>
  63. <a v-if="!list.packaging">—</a>
  64. </td>
  65. <!--<td>-->
  66. <!--<a v-if="list.produceDate">{{list.produceDate}}</a>-->
  67. <!--<a v-if="!list.produceDate">—</a>-->
  68. <!--</td>-->
  69. <td style="text-align: left;padding-left: 25px;">
  70. <a>
  71. <div v-if="list.reserve">
  72. <span>库存:</span>
  73. <span>{{list.reserve}}</span>
  74. </div>
  75. <div v-if="!list.reserve" style="text-align: center;margin-left: 0;"><span>—</span></div>
  76. <div v-if="list.reserve && list.reserve>0">
  77. <span>最小起订量:</span>
  78. <span v-if="list.minBuyQty">{{list.minBuyQty}}</span>
  79. </div>
  80. <div class="can-div-sell" v-if="list.breakUp" v-text="list.breakUp?'可拆卖':'不可拆卖'"></div>
  81. <!--<div>-->
  82. <!--<span>倍数:</span>-->
  83. <!--<span>{{list.minPackQty}}</span>-->
  84. <!--</div>-->
  85. </a>
  86. </td>
  87. <td>
  88. <a>
  89. <div v-for="price in list.prices">
  90. <span v-if="list.prices">{{price.start}}</span>+
  91. <span v-if="!list.prices">—</span>
  92. </div>
  93. </a>
  94. </td>
  95. <td>
  96. <a>
  97. <div v-show="list.currencyName.indexOf('USD')==-1 || !list.prices">
  98. <span>—</span>
  99. </div>
  100. <div v-for="price in list.prices">
  101. <span>{{price.uSDPrice | currency}}</span>
  102. </div>
  103. </a>
  104. </td>
  105. <td>
  106. <a>
  107. <div v-show="list.currencyName.indexOf('RMB')==-1 || !list.prices">
  108. <span>—</span>
  109. </div>
  110. <div v-for="price in list.prices">
  111. <span>{{price.rMBPrice | currency}}</span>
  112. </div>
  113. </a>
  114. </td>
  115. <td>
  116. <a>
  117. <div v-show="list.b2cMinDelivery">
  118. <span>交期:</span>
  119. <span>{{list.b2cMinDelivery}}</span>
  120. <span v-if="list.b2cMaxDelivery && list.b2cMaxDelivery !== list.b2cMinDelivery">-</span>
  121. <span v-if="list.b2cMaxDelivery && list.b2cMaxDelivery !== list.b2cMinDelivery">{{list.b2cMaxDelivery}}</span>
  122. </div>
  123. <div v-if="!list.b2cMinDelivery">
  124. <span>—</span>
  125. </div>
  126. </a>
  127. </td>
  128. <td>
  129. <buy :item="list" :disabledFlag="list.status === 602"></buy>
  130. </td>
  131. </tr>
  132. <tr v-if="!storeList.content || storeList.content.length == 0">
  133. <td colspan="12">
  134. <div class="empty">
  135. <p class="empty-img">
  136. <img src="/images/brandList/empty-cart.png">
  137. </p>
  138. <div class="empty-info">
  139. <p class="grey"> 暂无现货信息 </p>
  140. <a href="javascript:history.go(-1)"><i class="fa fa-mail-reply fa-xs"></i>返回上一页</a>
  141. </div>
  142. </div>
  143. </td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. <div style="float: right; margin-bottom: 15px;">
  148. <page :total="storeList.totalElements" :page-size="params.count"
  149. :current="params.page" @childEvent="handleCurrentChange"></page>
  150. </div>
  151. </div>
  152. </div>
  153. </template>
  154. <script>
  155. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  156. import Page from '~components/common/page/pageComponent.vue'
  157. export default {
  158. name: 'StoreInfo',
  159. data () {
  160. return {
  161. storeIds: [],
  162. UmallExist: false,
  163. storeExist: false,
  164. params: {
  165. count: 10,
  166. page: 1,
  167. sorting: {'minPriceRMB': 'ASC'},
  168. filter: {
  169. uuid: this.$route.params.uuid,
  170. ignoreUMall: false,
  171. ignoreStore: false,
  172. storeIds: '',
  173. status: 601
  174. }
  175. }
  176. }
  177. },
  178. components: {
  179. Buy,
  180. Page
  181. },
  182. filters: {
  183. currency: function (num) {
  184. if (typeof num === 'number') {
  185. if (num <= 0.000001) {
  186. num = 0.000001
  187. } else {
  188. if (num.toString().indexOf('.') === -1) {
  189. num += '.00'
  190. } else {
  191. let inputStr = num.toString()
  192. let arr = inputStr.split('.')
  193. let floatNum = arr[1]
  194. if (floatNum.length > 6) {
  195. num = inputStr.substring(0, arr[0].length + 7)
  196. if (Number(floatNum.charAt(6)) > 4) {
  197. num = (Number(num) * 1000000 + 1) / 1000000
  198. }
  199. } else if (floatNum.length === 1) {
  200. num = num + '0'
  201. }
  202. }
  203. }
  204. }
  205. return num
  206. }
  207. },
  208. computed: {
  209. user () {
  210. return this.$store.state.option.user
  211. },
  212. stores () {
  213. return this.$store.state.componentStore.store
  214. },
  215. store () {
  216. return this.stores.data
  217. },
  218. storeList () {
  219. let storeList = this.$store.state.componentInformation.information.data
  220. let _self = this
  221. if (storeList.content) {
  222. storeList.content.forEach(function (item) {
  223. _self.storeIds.push(item.storeid)
  224. })
  225. }
  226. if (this.storeIds.length > 0) {
  227. if (this.storeIds.indexOf(this.storeId) === -1) {
  228. this.storeExist = true
  229. } else {
  230. this.storeIds.splice(this.storeIds.indexOf(this.storeId), 1)
  231. if (this.storeIds.length > 0) {
  232. this.storeExist = true
  233. }
  234. this.UmallExist = true
  235. }
  236. }
  237. return storeList
  238. },
  239. storeId () {
  240. let UmallStoreId = this.$store.state.componentUmallStoreId.storeId.data
  241. return UmallStoreId
  242. },
  243. enterprise () {
  244. let ens = this.user.data.enterprises
  245. if (ens && ens.length) {
  246. return ens.find(item => item.current) || {enName: '个人账户'}
  247. } else {
  248. return {enName: '个人账户'}
  249. }
  250. }
  251. },
  252. methods: {
  253. addStore (storeIn) {
  254. if (typeof storeIn.isSelected === 'undefined') {
  255. storeIn.isSelected = false
  256. }
  257. storeIn.isSelected = !storeIn.isSelected
  258. // 点击请求处理
  259. let index = this.params.filter.storeIds.indexOf(storeIn.uuid)
  260. if (index === -1) {
  261. if (this.params.filter.storeIds === '') {
  262. this.params.filter.storeIds += storeIn.uuid
  263. } else {
  264. this.params.filter.storeIds += ',' + storeIn.uuid
  265. }
  266. } else {
  267. if (this.params.filter.storeIds.charAt(index + storeIn.uuid.length) === '') {
  268. if (this.params.filter.storeIds.charAt(index - 1) === ',') {
  269. this.params.filter.storeIds = this.params.filter.storeIds.replace(',' + storeIn.uuid, '')
  270. }
  271. this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid, '')
  272. } else {
  273. this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid + ',', '')
  274. }
  275. }
  276. this.params.page = 1
  277. this.reloadData()
  278. },
  279. filterType (type) {
  280. if (type === 'umall') {
  281. this.params.filter.ignoreUMall = !this.params.filter.ignoreUMall
  282. } else if (type === 'store') {
  283. this.params.filter.ignoreStore = !this.params.filter.ignoreStore
  284. }
  285. this.params.page = 1
  286. this.reloadData()
  287. },
  288. goProductDetail: function (batchCode) {
  289. window.location.href = '/store/productDetail/' + batchCode
  290. },
  291. sendprove: function () {
  292. if (this.user.logged) {
  293. if (this.enterprise && this.enterprise.isVendor === 313) {
  294. window.open('/vendor#/vendor_upload')
  295. } else {
  296. this.$router.push('/register-saler')
  297. }
  298. } else {
  299. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  300. }
  301. },
  302. reloadData () {
  303. this.$store.dispatch('loadComponentInformation', this.params)
  304. },
  305. handleCurrentChange: function (page) {
  306. this.params.page = page
  307. this.reloadData()
  308. }
  309. }
  310. }
  311. </script>
  312. <style scoped>
  313. .storeInfo .storeIns{
  314. margin-top: 20px;
  315. width: 1190px;
  316. line-height: 48px;
  317. position: relative;
  318. padding-left: 70px;
  319. }
  320. .storeInfo .storeIns .sign {
  321. display: inline-block;
  322. vertical-align: middle;
  323. font-size: 14px;
  324. position: absolute;
  325. left: 0;
  326. top: 0;
  327. }
  328. .storeInfo .storeIns .storeInList {
  329. display: inline-block;
  330. }
  331. .storeInfo .choose {
  332. border: 1px solid #ccc;
  333. }
  334. .storeInfo .storeIn {
  335. width: 98px;
  336. height: 49px;
  337. line-height: 30px;
  338. float: left;
  339. border: 1px solid #ccc;
  340. text-align: center;
  341. vertical-align: middle;
  342. margin-right: 15px;
  343. cursor: pointer;
  344. }
  345. .storeInfo .storeIn-active {
  346. width: 98px;
  347. height: 49px;
  348. line-height: 46px;
  349. float: left;
  350. border: 1px solid #5078cb;
  351. text-align: center;
  352. vertical-align: middle;
  353. margin-right: 15px;
  354. cursor: pointer;
  355. }
  356. .storeInfo .storeIn a,.componentDetail .storeIn-active a {
  357. display: table-cell;
  358. height: 49px;
  359. width: 98px;
  360. text-align: center;
  361. vertical-align: middle;
  362. }
  363. .storeInList .choose a img{
  364. max-width: 95px;
  365. max-height: 45px;
  366. margin-bottom: 1px;
  367. }
  368. a.storeLogo>img,.storeIn-active a.storeLogo>img {
  369. max-width: 95px;
  370. max-height: 46px;
  371. }
  372. .storeInfo .goodsList {
  373. clear: both;
  374. font-size: 14px;
  375. }
  376. .storeInfo .goodsList .flex{
  377. display: flex;
  378. width: 100%;
  379. }
  380. .storeInfo .goodsList .flex_item {
  381. flex: 1
  382. }
  383. .storeInfo .goodsList .goods-item {
  384. height: 30px;
  385. width: 120px;
  386. background-color: #5078cb;
  387. color: #fff;
  388. text-align: center;
  389. vertical-align: middle;
  390. line-height: 30px;
  391. }
  392. .storeInfo .goodsList .sendprove {
  393. background: #fff;
  394. color: #5078CB;
  395. border-radius: 4px;
  396. border: 1px solid #5078CB;
  397. height: 30px;
  398. border-radius: 0px;
  399. }
  400. .storeInfo .goodsList .sendprove:hover {
  401. background: #5078CB;
  402. color: #fff;
  403. cursor: pointer;
  404. transition: all 0.4s
  405. }
  406. .storeInfo .goodsList thead {
  407. background-color: #F7F7F7;
  408. border:2px solid #f7f7f7;
  409. }
  410. .storeInfo .goodsList tbody tr td{
  411. vertical-align: middle;
  412. text-align: center;
  413. }
  414. .storeInfo .goodsList tbody tr td .sellout-flag {
  415. position: absolute;
  416. right: 0;
  417. bottom: 0;
  418. }
  419. .storeInfo .goodsList tbody tr td a {
  420. color: #474443;
  421. }
  422. .storeInfo .goodsList tbody tr td:hover a{
  423. color: #474443;
  424. }
  425. /*.storeInfo .goodsList .btn{*/
  426. /*border-radius: 4px;*/
  427. /*width: 80px;*/
  428. /*height: 30px;*/
  429. /*color: #214797;*/
  430. /*font-size: 14px;*/
  431. /*line-height: 14px;*/
  432. /*text-align: center;*/
  433. /*margin: 5px 0;*/
  434. /*padding: 0;*/
  435. /*user-select: none;*/
  436. /*background-image: none;*/
  437. /*border: 1px solid transparent;*/
  438. /*font-weight: 400;*/
  439. /*}*/
  440. /*.storeInfo .goodsList .btn-buyNow {*/
  441. /*color: #fff;*/
  442. /*background-color: #5078cb;*/
  443. /*}*/
  444. /*.storeInfo .goodsList .btn-default{*/
  445. /*background-color: #fff;*/
  446. /*border-color: #ccc;*/
  447. /*}*/
  448. .storeInfo .form-group input{
  449. vertical-align: sub;
  450. }
  451. .storeInfo .height54{
  452. height: 54px;
  453. background: none;
  454. color: #333;
  455. }
  456. .storeInfo .height54 th{
  457. line-height: 54px;
  458. border-bottom: none;
  459. padding: 0;
  460. }
  461. .storeInfo .table tbody td{
  462. border-bottom: #ddd 1px solid;
  463. border-top: none;
  464. }
  465. .storeInfo .table tbody{
  466. border-left: #ddd 1px solid;
  467. border-right: #ddd 1px solid;
  468. }
  469. .storeInfo .table tbody td div{
  470. margin-left: 10%;
  471. }
  472. .storeInfo .table tbody tr:hover{
  473. background: #ecf2fd;
  474. }
  475. .storeInfo .goodsList .can-div-sell {
  476. text-align: left;
  477. color: #333;
  478. }
  479. /**/
  480. .storeInfo .empty{
  481. overflow: hidden;
  482. margin: 0!important;
  483. height:130px;
  484. display:inline-flex;
  485. align-items: center;
  486. }
  487. .storeInfo .empty-info{
  488. line-height: 14px;
  489. width: 143px;
  490. }
  491. .empty-info .grey{
  492. color: #999;
  493. font-size: 14px;
  494. }
  495. .storeInfo .empty .empty-info>a{
  496. font-size: 14px;
  497. color: #5078cb;
  498. }
  499. .storeInfo .empty .empty-info i{
  500. margin-right:5px;
  501. }
  502. </style>