StoreInfo.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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="goods-item">按商家列表</div>
  34. <table class="table">
  35. <thead>
  36. <tr class="height54">
  37. <th class="text-center" width="100">制造商型号</th>
  38. <th class="text-center" width="120">生产日期</th>
  39. <th class="text-center" width="80">包装方式</th>
  40. <th class="text-center" width="150">库存</th>
  41. <th class="text-center" width="80">数量</th>
  42. <th class="text-center" width="100">香港交货<span style="font-size: 12px;">($)</span></th>
  43. <th class="text-center" width="130">大陆交货<span style="font-size: 12px;">(¥)</span></th>
  44. <th class="text-center" width="120">交期<span style="font-size: 12px;">(天)</span></th>
  45. <th class="text-center" width="140">操作</th>
  46. </tr>
  47. </thead>
  48. <tbody class="text-center">
  49. <tr style="cursor: pointer;" v-for="list in storeList.content" @click="goProductDetail(list.storeid, list.batchCode)">
  50. <td>
  51. <a v-if="list.code">{{list.code}}</a>
  52. <a v-if="!list.code">—</a>
  53. </td>
  54. <td>
  55. <a v-if="list.produceDate">{{list.produceDate}}</a>
  56. <a v-if="!list.produceDate">—</a>
  57. </td>
  58. <td>
  59. <a v-if="list.packaging">{{list.packaging}}</a>
  60. <a v-if="!list.packaging">—</a>
  61. </td>
  62. <td style="text-align: left;padding-left: 25px;">
  63. <a>
  64. <div v-if="list.reserve">
  65. <span>库存:</span>
  66. <span>{{list.reserve}}</span>
  67. </div>
  68. <div v-if="!list.reserve" style="text-align: center;margin-left: 0;"><span>—</span></div>
  69. <div v-if="list.reserve && list.reserve>0">
  70. <span>起拍:</span>
  71. <span v-if="list.minBuyQty">{{list.minBuyQty}}</span>
  72. </div>
  73. <div class="can-div-sell" v-text="list.breakUp?'可拆卖':'不可拆卖'"></div>
  74. <!--<div>-->
  75. <!--<span>倍数:</span>-->
  76. <!--<span>{{list.minPackQty}}</span>-->
  77. <!--</div>-->
  78. </a>
  79. </td>
  80. <td>
  81. <a>
  82. <div v-for="price in list.prices">
  83. <span v-if="list.prices">{{price.start}}</span>+
  84. <span v-if="!list.prices">—</span>
  85. </div>
  86. </a>
  87. </td>
  88. <td>
  89. <a>
  90. <div v-show="list.currencyName.indexOf('USD')==-1 || !list.prices">
  91. <span>—</span>
  92. </div>
  93. <div v-for="price in list.prices">
  94. <span>{{price.uSDPrice | currency}}</span>
  95. </div>
  96. </a>
  97. </td>
  98. <td>
  99. <a>
  100. <div v-show="list.currencyName.indexOf('RMB')==-1 || !list.prices">
  101. <span>—</span>
  102. </div>
  103. <div v-for="price in list.prices">
  104. <span>{{price.rMBPrice | currency}}</span>
  105. </div>
  106. </a>
  107. </td>
  108. <td>
  109. <a>
  110. <div v-show="list.b2cMinDelivery">
  111. <span>交期:</span>
  112. <span>{{list.b2cMinDelivery}}</span>
  113. <span v-if="list.b2cMaxDelivery && list.b2cMaxDelivery !== list.b2cMinDelivery">-</span>
  114. <span v-if="list.b2cMaxDelivery && list.b2cMaxDelivery !== list.b2cMinDelivery">{{list.b2cMaxDelivery}}</span>
  115. </div>
  116. <div v-if="!list.b2cMinDelivery">
  117. <span>—</span>
  118. </div>
  119. </a>
  120. </td>
  121. <td>
  122. <buy :item="list"></buy>
  123. </td>
  124. </tr>
  125. <tr v-if="!storeList.content || storeList.content.length == 0">
  126. <td colspan="12">
  127. <div class="empty">
  128. <p class="empty-img">
  129. <img src="/images/brandList/empty-cart.png">
  130. </p>
  131. <div class="empty-info">
  132. <p class="grey"> 暂无现货信息 </p>
  133. <a href="javascript:history.go(-1)"><i class="fa fa-mail-reply fa-xs"></i>返回上一页</a>
  134. </div>
  135. </div>
  136. </td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. </div>
  141. </div>
  142. </template>
  143. <script>
  144. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  145. export default {
  146. name: 'StoreInfo',
  147. data () {
  148. return {
  149. storeIds: [],
  150. UmallExist: false,
  151. storeExist: false,
  152. params: {
  153. count: 10,
  154. page: 1,
  155. sorting: {'minPriceRMB': 'ASC'},
  156. filter: {
  157. uuid: this.$route.params.uuid,
  158. ignoreUMall: false,
  159. ignoreStore: false,
  160. storeIds: ''
  161. }
  162. }
  163. }
  164. },
  165. components: {
  166. Buy
  167. },
  168. filters: {
  169. currency: function (num) {
  170. if (typeof num === 'number') {
  171. if (num <= 0.000001) {
  172. num = 0.000001
  173. } else {
  174. if (num.toString().indexOf('.') === -1) {
  175. num += '.00'
  176. } else {
  177. let inputStr = num.toString()
  178. let arr = inputStr.split('.')
  179. let floatNum = arr[1]
  180. if (floatNum.length > 6) {
  181. num = inputStr.substring(0, arr[0].length + 7)
  182. if (Number(floatNum.charAt(6)) > 4) {
  183. num = (Number(num) * 1000000 + 1) / 1000000
  184. }
  185. } else if (floatNum.length === 1) {
  186. num = num + '0'
  187. }
  188. }
  189. }
  190. }
  191. return num
  192. }
  193. },
  194. computed: {
  195. stores () {
  196. return this.$store.state.componentStore.store
  197. },
  198. store () {
  199. return this.stores.data
  200. },
  201. storeList () {
  202. let storeList = this.$store.state.componentInformation.information.data
  203. let _self = this
  204. if (storeList.content) {
  205. storeList.content.forEach(function (item) {
  206. _self.storeIds.push(item.storeid)
  207. })
  208. }
  209. if (this.storeIds.length > 0) {
  210. if (this.storeIds.indexOf(this.storeId) === -1) {
  211. this.storeExist = true
  212. } else {
  213. this.storeIds.splice(this.storeIds.indexOf(this.storeId), 1)
  214. if (this.storeIds.length > 0) {
  215. this.storeExist = true
  216. }
  217. this.UmallExist = true
  218. }
  219. }
  220. return storeList
  221. },
  222. storeId () {
  223. let UmallStoreId = this.$store.state.componentUmallStoreId.storeId.data
  224. return UmallStoreId
  225. }
  226. },
  227. methods: {
  228. addStore (storeIn) {
  229. if (typeof storeIn.isSelected === 'undefined') {
  230. storeIn.isSelected = false
  231. }
  232. storeIn.isSelected = !storeIn.isSelected
  233. // 点击请求处理
  234. let index = this.params.filter.storeIds.indexOf(storeIn.uuid)
  235. if (index === -1) {
  236. if (this.params.filter.storeIds === '') {
  237. this.params.filter.storeIds += storeIn.uuid
  238. } else {
  239. this.params.filter.storeIds += ',' + storeIn.uuid
  240. }
  241. } else {
  242. if (this.params.filter.storeIds.charAt(index + storeIn.uuid.length) === '') {
  243. if (this.params.filter.storeIds.charAt(index - 1) === ',') {
  244. this.params.filter.storeIds = this.params.filter.storeIds.replace(',' + storeIn.uuid, '')
  245. }
  246. this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid, '')
  247. } else {
  248. this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid + ',', '')
  249. }
  250. }
  251. this.$store.dispatch('loadComponentInformation', this.params)
  252. },
  253. filterType (type) {
  254. if (type === 'umall') {
  255. this.params.filter.ignoreUMall = !this.params.filter.ignoreUMall
  256. } else if (type === 'store') {
  257. this.params.filter.ignoreStore = !this.params.filter.ignoreStore
  258. }
  259. this.$store.dispatch('loadComponentInformation', this.params)
  260. },
  261. goProductDetail: function (storeid, batchcode) {
  262. window.location.href = '/store/' + storeid + '/' + batchcode
  263. }
  264. }
  265. }
  266. </script>
  267. <style scoped>
  268. .storeInfo .storeIns{
  269. margin-top: 20px;
  270. width: 1190px;
  271. height: 48px;
  272. line-height: 48px;
  273. }
  274. .storeInfo .storeIns .sign {
  275. display: table-cell;
  276. vertical-align: middle;
  277. font-size: 14px;
  278. }
  279. .storeInfo .storeIns .storeInList {
  280. display: table-cell;
  281. }
  282. .storeInfo .choose {
  283. border: 1px solid #ccc;
  284. }
  285. .storeInfo .storeIn {
  286. width: 98px;
  287. height: 49px;
  288. line-height: 30px;
  289. float: left;
  290. border: 1px solid #ccc;
  291. text-align: center;
  292. vertical-align: middle;
  293. margin-right: 15px;
  294. cursor: pointer;
  295. }
  296. .storeInfo .storeIn-active {
  297. width: 98px;
  298. height: 49px;
  299. line-height: 46px;
  300. float: left;
  301. border: 1px solid #5078cb;
  302. text-align: center;
  303. vertical-align: middle;
  304. margin-right: 15px;
  305. cursor: pointer;
  306. }
  307. .storeInfo .storeIn a,.componentDetail .storeIn-active a {
  308. display: table-cell;
  309. height: 49px;
  310. width: 98px;
  311. text-align: center;
  312. vertical-align: middle;
  313. }
  314. .storeInList .choose a img{
  315. max-width: 95px;
  316. max-height: 45px;
  317. margin-bottom: 1px;
  318. }
  319. a.storeLogo>img,.storeIn-active a.storeLogo>img {
  320. max-width: 95px;
  321. max-height: 46px;
  322. }
  323. .storeInfo .goodsList {
  324. clear: both;
  325. font-size: 14px;
  326. }
  327. .storeInfo .goodsList .goods-item {
  328. height: 30px;
  329. width: 120px;
  330. background-color: #5078cb;
  331. color: #fff;
  332. text-align: center;
  333. vertical-align: middle;
  334. line-height: 30px;
  335. }
  336. .storeInfo .goodsList thead {
  337. background-color: #F7F7F7;
  338. border:2px solid #f7f7f7;
  339. }
  340. .storeInfo .goodsList tbody tr td{
  341. vertical-align: middle;
  342. text-align: center;
  343. }
  344. .storeInfo .goodsList tbody tr td a {
  345. color: #474443;
  346. }
  347. .storeInfo .goodsList tbody tr td:hover a{
  348. color: #474443;
  349. }
  350. /*.storeInfo .goodsList .btn{*/
  351. /*border-radius: 4px;*/
  352. /*width: 80px;*/
  353. /*height: 30px;*/
  354. /*color: #214797;*/
  355. /*font-size: 14px;*/
  356. /*line-height: 14px;*/
  357. /*text-align: center;*/
  358. /*margin: 5px 0;*/
  359. /*padding: 0;*/
  360. /*user-select: none;*/
  361. /*background-image: none;*/
  362. /*border: 1px solid transparent;*/
  363. /*font-weight: 400;*/
  364. /*}*/
  365. /*.storeInfo .goodsList .btn-buyNow {*/
  366. /*color: #fff;*/
  367. /*background-color: #5078cb;*/
  368. /*}*/
  369. /*.storeInfo .goodsList .btn-default{*/
  370. /*background-color: #fff;*/
  371. /*border-color: #ccc;*/
  372. /*}*/
  373. .storeInfo .form-group input{
  374. vertical-align: sub;
  375. }
  376. .storeInfo .height54{
  377. height: 54px;
  378. background: none;
  379. color: #333;
  380. }
  381. .storeInfo .height54 th{
  382. line-height: 54px;
  383. border-bottom: none;
  384. padding: 0;
  385. }
  386. .storeInfo .table tbody td{
  387. border-bottom: #ddd 1px solid;
  388. border-top: none;
  389. }
  390. .storeInfo .table tbody{
  391. border-left: #ddd 1px solid;
  392. border-right: #ddd 1px solid;
  393. }
  394. .storeInfo .table tbody td div{
  395. margin-left: 10%;
  396. }
  397. .storeInfo .table tbody tr:hover{
  398. background: #f5f5f5;
  399. }
  400. .storeInfo .table tbody tr:hover{
  401. background: #f5f5f5;
  402. }
  403. .storeInfo .goodsList .can-div-sell {
  404. text-align: left;
  405. color: #333;
  406. }
  407. /**/
  408. .storeInfo .empty{
  409. overflow: hidden;
  410. margin: 0!important;
  411. height:130px;
  412. display:inline-flex;
  413. align-items: center;
  414. }
  415. .storeInfo .empty-info{
  416. line-height: 14px;
  417. width: 143px;
  418. }
  419. .empty-info .grey{
  420. color: #999;
  421. font-size: 14px;
  422. }
  423. .storeInfo .empty .empty-info>a{
  424. font-size: 14px;
  425. color: #5078cb;
  426. }
  427. .storeInfo .empty .empty-info i{
  428. margin-right:5px;
  429. }
  430. </style>