StoreInfo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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="100">型号</th>
  44. <th class="text-center" width="80">包装方式</th>
  45. <th class="text-center" width="120">生产日期</th>
  46. <th class="text-center" width="150">库存</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="120">交期<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>
  148. </div>
  149. </template>
  150. <script>
  151. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  152. export default {
  153. name: 'StoreInfo',
  154. data () {
  155. return {
  156. storeIds: [],
  157. UmallExist: false,
  158. storeExist: false,
  159. params: {
  160. count: 10,
  161. page: 1,
  162. sorting: {'minPriceRMB': 'ASC'},
  163. filter: {
  164. uuid: this.$route.params.uuid,
  165. ignoreUMall: false,
  166. ignoreStore: false,
  167. storeIds: ''
  168. }
  169. }
  170. }
  171. },
  172. components: {
  173. Buy
  174. },
  175. filters: {
  176. currency: function (num) {
  177. if (typeof num === 'number') {
  178. if (num <= 0.000001) {
  179. num = 0.000001
  180. } else {
  181. if (num.toString().indexOf('.') === -1) {
  182. num += '.00'
  183. } else {
  184. let inputStr = num.toString()
  185. let arr = inputStr.split('.')
  186. let floatNum = arr[1]
  187. if (floatNum.length > 6) {
  188. num = inputStr.substring(0, arr[0].length + 7)
  189. if (Number(floatNum.charAt(6)) > 4) {
  190. num = (Number(num) * 1000000 + 1) / 1000000
  191. }
  192. } else if (floatNum.length === 1) {
  193. num = num + '0'
  194. }
  195. }
  196. }
  197. }
  198. return num
  199. }
  200. },
  201. computed: {
  202. user () {
  203. return this.$store.state.option.user
  204. },
  205. stores () {
  206. return this.$store.state.componentStore.store
  207. },
  208. store () {
  209. return this.stores.data
  210. },
  211. storeList () {
  212. let storeList = this.$store.state.componentInformation.information.data
  213. let _self = this
  214. if (storeList.content) {
  215. storeList.content.forEach(function (item) {
  216. _self.storeIds.push(item.storeid)
  217. })
  218. }
  219. if (this.storeIds.length > 0) {
  220. if (this.storeIds.indexOf(this.storeId) === -1) {
  221. this.storeExist = true
  222. } else {
  223. this.storeIds.splice(this.storeIds.indexOf(this.storeId), 1)
  224. if (this.storeIds.length > 0) {
  225. this.storeExist = true
  226. }
  227. this.UmallExist = true
  228. }
  229. }
  230. return storeList
  231. },
  232. storeId () {
  233. let UmallStoreId = this.$store.state.componentUmallStoreId.storeId.data
  234. return UmallStoreId
  235. },
  236. enterprise () {
  237. let ens = this.user.data.enterprises
  238. if (ens && ens.length) {
  239. return ens.find(item => item.current) || {enName: '个人账户'}
  240. } else {
  241. return {enName: '个人账户'}
  242. }
  243. }
  244. },
  245. methods: {
  246. addStore (storeIn) {
  247. if (typeof storeIn.isSelected === 'undefined') {
  248. storeIn.isSelected = false
  249. }
  250. storeIn.isSelected = !storeIn.isSelected
  251. // 点击请求处理
  252. let index = this.params.filter.storeIds.indexOf(storeIn.uuid)
  253. if (index === -1) {
  254. if (this.params.filter.storeIds === '') {
  255. this.params.filter.storeIds += storeIn.uuid
  256. } else {
  257. this.params.filter.storeIds += ',' + storeIn.uuid
  258. }
  259. } else {
  260. if (this.params.filter.storeIds.charAt(index + storeIn.uuid.length) === '') {
  261. if (this.params.filter.storeIds.charAt(index - 1) === ',') {
  262. this.params.filter.storeIds = this.params.filter.storeIds.replace(',' + storeIn.uuid, '')
  263. }
  264. this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid, '')
  265. } else {
  266. this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid + ',', '')
  267. }
  268. }
  269. this.$store.dispatch('loadComponentInformation', this.params)
  270. },
  271. filterType (type) {
  272. if (type === 'umall') {
  273. this.params.filter.ignoreUMall = !this.params.filter.ignoreUMall
  274. } else if (type === 'store') {
  275. this.params.filter.ignoreStore = !this.params.filter.ignoreStore
  276. }
  277. this.$store.dispatch('loadComponentInformation', this.params)
  278. },
  279. goProductDetail: function (batchCode) {
  280. window.location.href = '/store/productDetail/' + batchCode
  281. },
  282. sendprove: function () {
  283. if (this.user.logged) {
  284. if (this.enterprise && this.enterprise.isVendor === 313) {
  285. window.open('/vendor#/vendor_upload')
  286. } else {
  287. this.$router.push('/register-saler')
  288. }
  289. } else {
  290. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  291. }
  292. }
  293. }
  294. }
  295. </script>
  296. <style scoped>
  297. .storeInfo .storeIns{
  298. margin-top: 20px;
  299. width: 1190px;
  300. line-height: 48px;
  301. position: relative;
  302. padding-left: 70px;
  303. }
  304. .storeInfo .storeIns .sign {
  305. display: inline-block;
  306. vertical-align: middle;
  307. font-size: 14px;
  308. position: absolute;
  309. left: 0;
  310. top: 0;
  311. }
  312. .storeInfo .storeIns .storeInList {
  313. display: inline-block;
  314. }
  315. .storeInfo .choose {
  316. border: 1px solid #ccc;
  317. }
  318. .storeInfo .storeIn {
  319. width: 98px;
  320. height: 49px;
  321. line-height: 30px;
  322. float: left;
  323. border: 1px solid #ccc;
  324. text-align: center;
  325. vertical-align: middle;
  326. margin-right: 15px;
  327. cursor: pointer;
  328. }
  329. .storeInfo .storeIn-active {
  330. width: 98px;
  331. height: 49px;
  332. line-height: 46px;
  333. float: left;
  334. border: 1px solid #5078cb;
  335. text-align: center;
  336. vertical-align: middle;
  337. margin-right: 15px;
  338. cursor: pointer;
  339. }
  340. .storeInfo .storeIn a,.componentDetail .storeIn-active a {
  341. display: table-cell;
  342. height: 49px;
  343. width: 98px;
  344. text-align: center;
  345. vertical-align: middle;
  346. }
  347. .storeInList .choose a img{
  348. max-width: 95px;
  349. max-height: 45px;
  350. margin-bottom: 1px;
  351. }
  352. a.storeLogo>img,.storeIn-active a.storeLogo>img {
  353. max-width: 95px;
  354. max-height: 46px;
  355. }
  356. .storeInfo .goodsList {
  357. clear: both;
  358. font-size: 14px;
  359. }
  360. .storeInfo .goodsList .flex{
  361. display: flex;
  362. width: 100%;
  363. }
  364. .storeInfo .goodsList .flex_item {
  365. flex: 1
  366. }
  367. .storeInfo .goodsList .goods-item {
  368. height: 30px;
  369. width: 120px;
  370. background-color: #5078cb;
  371. color: #fff;
  372. text-align: center;
  373. vertical-align: middle;
  374. line-height: 30px;
  375. }
  376. .storeInfo .goodsList .sendprove {
  377. background: #fff;
  378. color: #5078CB;
  379. border-radius: 4px;
  380. border: 1px solid #5078CB;
  381. height: 30px;
  382. border-radius: 0px;
  383. }
  384. .storeInfo .goodsList .sendprove:hover {
  385. background: #5078CB;
  386. color: #fff;
  387. cursor: pointer;
  388. transition: all 0.4s
  389. }
  390. .storeInfo .goodsList thead {
  391. background-color: #F7F7F7;
  392. border:2px solid #f7f7f7;
  393. }
  394. .storeInfo .goodsList tbody tr td{
  395. vertical-align: middle;
  396. text-align: center;
  397. }
  398. .storeInfo .goodsList tbody tr td .sellout-flag {
  399. position: absolute;
  400. right: 0;
  401. bottom: 0;
  402. }
  403. .storeInfo .goodsList tbody tr td a {
  404. color: #474443;
  405. }
  406. .storeInfo .goodsList tbody tr td:hover a{
  407. color: #474443;
  408. }
  409. /*.storeInfo .goodsList .btn{*/
  410. /*border-radius: 4px;*/
  411. /*width: 80px;*/
  412. /*height: 30px;*/
  413. /*color: #214797;*/
  414. /*font-size: 14px;*/
  415. /*line-height: 14px;*/
  416. /*text-align: center;*/
  417. /*margin: 5px 0;*/
  418. /*padding: 0;*/
  419. /*user-select: none;*/
  420. /*background-image: none;*/
  421. /*border: 1px solid transparent;*/
  422. /*font-weight: 400;*/
  423. /*}*/
  424. /*.storeInfo .goodsList .btn-buyNow {*/
  425. /*color: #fff;*/
  426. /*background-color: #5078cb;*/
  427. /*}*/
  428. /*.storeInfo .goodsList .btn-default{*/
  429. /*background-color: #fff;*/
  430. /*border-color: #ccc;*/
  431. /*}*/
  432. .storeInfo .form-group input{
  433. vertical-align: sub;
  434. }
  435. .storeInfo .height54{
  436. height: 54px;
  437. background: none;
  438. color: #333;
  439. }
  440. .storeInfo .height54 th{
  441. line-height: 54px;
  442. border-bottom: none;
  443. padding: 0;
  444. }
  445. .storeInfo .table tbody td{
  446. border-bottom: #ddd 1px solid;
  447. border-top: none;
  448. }
  449. .storeInfo .table tbody{
  450. border-left: #ddd 1px solid;
  451. border-right: #ddd 1px solid;
  452. }
  453. .storeInfo .table tbody td div{
  454. margin-left: 10%;
  455. }
  456. .storeInfo .table tbody tr:hover{
  457. background: #ecf2fd;
  458. }
  459. .storeInfo .goodsList .can-div-sell {
  460. text-align: left;
  461. color: #333;
  462. }
  463. /**/
  464. .storeInfo .empty{
  465. overflow: hidden;
  466. margin: 0!important;
  467. height:130px;
  468. display:inline-flex;
  469. align-items: center;
  470. }
  471. .storeInfo .empty-info{
  472. line-height: 14px;
  473. width: 143px;
  474. }
  475. .empty-info .grey{
  476. color: #999;
  477. font-size: 14px;
  478. }
  479. .storeInfo .empty .empty-info>a{
  480. font-size: 14px;
  481. color: #5078cb;
  482. }
  483. .storeInfo .empty .empty-info i{
  484. margin-right:5px;
  485. }
  486. </style>