StoreInfo.vue 12 KB

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