StoreInfo.vue 13 KB

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