StoreInfo.vue 12 KB

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