CommodityList.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. <template>
  2. <div id="goods-list-fragment">
  3. <el-dialog
  4. title="我要询价"
  5. :visible.sync="hasDialog">
  6. <div class="form_dialog">
  7. <ul class="list-inline">
  8. <li class="form-item">
  9. <span>品牌:</span>
  10. <p v-text="applyObj.brand ? spliceString(applyObj.brand, 90) : '-'">32432</p>
  11. </li>
  12. <li class="form-item">
  13. <span>物料名称:</span>
  14. <p v-text="applyObj.prodName ? spliceString(applyObj.prodName, 90) : '-'">32</p>
  15. </li>
  16. <li class="form-item">
  17. <span>型号:</span>
  18. <p v-text="applyObj.cmpCode ? spliceString(applyObj.cmpCode, 90) : '-'">32432</p>
  19. </li>
  20. <li class="form-item">
  21. <span>规格:</span>
  22. <p v-text="applyObj.spec ? spliceString(applyObj.spec, 90) : '-'">32432</p>
  23. </li>
  24. <li class="form-item">
  25. <span><i>*</i>截止日期:</span>
  26. <el-date-picker
  27. :class="{'error': !validObj.deadline}"
  28. v-model="applyObj.deadline"
  29. type="date"
  30. :picker-options="pickerOptions"
  31. @change="setDeadLineValid"
  32. :editable="false"
  33. :clearable="true"
  34. size="mini">
  35. </el-date-picker>
  36. </li>
  37. <li class="form-item">
  38. <span>封装:</span>
  39. <input type="text" class="form-control" v-model="applyObj.encapsulation"/>
  40. </li>
  41. <!--<li class="form-item">-->
  42. <!--<span>单价预算:</span>-->
  43. <!--<select v-model="applyObj.currency" class="form-control" style="width:40px;">-->
  44. <!--<option value="RMB">¥</option>-->
  45. <!--<option value="USD">$</option>-->
  46. <!--</select>-->
  47. <!--<input type="number" v-model="applyObj.unitPrice" class="form-control" :class="{'error': !validObj.unitPrice}"/>-->
  48. <!--</li>-->
  49. <!--<li class="form-item">-->
  50. <!--<span>生产日期:</span>-->
  51. <!--<input type="text" class="form-control" v-model="applyObj.produceDate"/>-->
  52. <!--</li>-->
  53. <li class="form-item">
  54. <span>采购数量(PCS):</span>
  55. <input type="number" class="form-control" v-model="applyObj.amount" :class="{'error': !validObj.amount}"/>
  56. </li>
  57. </ul>
  58. </div>
  59. <span slot="footer" class="dialog-footer">
  60. <button @click="authorityInterceptor(baseUrls.userPublishSeek, goPublish)" :disabled="isClick">询价提交</button>
  61. </span>
  62. </el-dialog>
  63. <div class="container">
  64. <div class="content-adv">
  65. <div class="title-adv"><span>全球共享交易平台</span><span>全球共享询价平台</span></div>
  66. <div class="input-group">
  67. <input type="search" class="form-control" id="search_input" title="code" placeholder="型号/品牌"
  68. v-model="searchCode" @search="goodsSearch(searchCode)"/>
  69. <span class="input-group-btn">
  70. <button type="button" class="btn" id="search_btn" @click="goodsSearch(searchCode)">&nbsp;搜&nbsp;索&nbsp;</button>
  71. </span>
  72. <span class="input-group-btn">
  73. <button type="button" class="btn sendprove" @click="sendprove()">我要发布产品</button>
  74. </span>
  75. </div>
  76. </div>
  77. <!--<div class="title-area">
  78. <div class="category-title">
  79. <span style="line-height: 34px;">产品分类</span>
  80. </div>
  81. <div class="category-content">
  82. <el-tree :data="data1" :props="defaultProps" accordion :highlight-current="true" @current-change="handlerCurrentNode" :default-expanded-keys="[0]" node-key="id" @node-collapse="onNodeCollapse">
  83. &lt;!&ndash;<span class="custom-tree-node" slot-scope="{ node, data }">&ndash;&gt;
  84. &lt;!&ndash;<span>{{ node.nameCn }}</span>&ndash;&gt;
  85. &lt;!&ndash;<span>{{ node.count }}</span>&ndash;&gt;
  86. &lt;!&ndash;</span>&ndash;&gt;
  87. </el-tree>
  88. &lt;!&ndash;<span class="empty" v-if="!kinds[0].children || !kinds[0].children.length">暂无数据</span>&ndash;&gt;
  89. </div>
  90. </div>-->
  91. <!-- 产品列表 -->
  92. <div class="goods-area">
  93. <!-- 列表展示 -->
  94. <table class="goodslist" style="width: 955px;background:#fff;" >
  95. <thead>
  96. <tr>
  97. <th width="165"><div>品牌/物料名称</div></th>
  98. <th width="148"><div>型号/规格</div></th>
  99. <th width="114"><div>包装</div></th>
  100. <th width="125"><div>库存</div></th>
  101. <!-- <th width="90">数量</th>
  102. <th width="90">香港交货<span style="font-size: 12px;">($)</span></th>
  103. <th width="100">大陆交货<span style="font-size: 12px;">(¥)</span></th>-->
  104. <th width="149"><div>价格梯度(PCS)</div></th>
  105. <th width="67"><div>交期(天)</div></th>
  106. <th width="66"><div>规格书</div></th>
  107. <th width="95"><div>操作</div></th>
  108. </tr>
  109. </thead>
  110. <tbody id="goodslist-content">
  111. <tr v-for="commodity in commodities.content" @click="goBatchDetail(commodity.batchCode)">
  112. <td class="brand-code">
  113. <img class="sellout-store-commodity" v-if="commodity.status === 602" src="/images/search/sellout-search.png" alt="">
  114. <img class="specific-price-tag" v-if="isSpecificPriceTag(commodity.tag) && isConsignment" src="/images/floor/specificPrice-store.png" alt="">
  115. <div class="brand" v-if="commodity.brandNameEn || commodity.brandEn">
  116. <a v-if="commodity.brandNameEn && commodity.branduuid" @click="goBrandDetail('/product/brand/' + commodity.branduuid, $event)" v-text="commodity.brandNameEn" :title="commodity.brandNameEn"></a>
  117. <span v-if="commodity.brandNameEn && !commodity.branduuid" v-text="commodity.brandNameEn" :title="commodity.brandNameEn"></span>
  118. <span v-if="commodity.brandEn && !commodity.branduuid" :title="commodity.brandEn">{{commodity.brandEn}}</span>
  119. </div>
  120. <div class="brand" v-if="!commodity.brandNameEn && !commodity.brandEn && commodity.kindNameCn">—</div>
  121. <a v-if="commodity.kindNameCn && commodity.kindUuid" @click="goBrandDetail('/product/kind/' + commodity.kindUuid, $event)" v-text="commodity.kindNameCn" :title="commodity.kindNameCn"></a>
  122. <span v-if="commodity.kindNameCn && !commodity.kindUuid" v-text="commodity.kindNameCn" :title="commodity.kindNameCn"></span>
  123. <div class="brand" v-if="!commodity.kindNameCn && (commodity.brandNameEn || commodity.brandEn)">—</div>
  124. <div class="brand" v-if="!commodity.brandNameEn && !commodity.brandEn && !commodity.kindNameCn">—</div>
  125. </td>
  126. <td class="brand-code">
  127. <div class="code" v-if="commodity.code" v-text="commodity.code" :title="commodity.code"></div>
  128. <div class="code" v-if="!commodity.code">—</div>
  129. <div class="brand spec" v-text="commodity.spec || '—'" :title="commodity.spec"></div>
  130. </td>
  131. <td>
  132. <div class="package" v-if="commodity.packaging" v-text="commodity.packaging" :title="commodity.packaging"></div>
  133. <div class="package" v-if="!commodity.packaging && !commodity.produceDate">—</div>
  134. <!--<div class="date" v-if='commodity.produceDate' v-text="commodity.produceDate" :title="commodity.produceDate">2016-12-01</div>-->
  135. </td>
  136. <td style="text-align: left;vertical-align: middle;">
  137. <div class="goods" v-if="commodity.reserve">
  138. 库存:<span v-text="commodity.reserve" :title="commodity.reserve">31500</span>
  139. </div>
  140. <div v-if="!commodity.reserve" style="text-align: center;margin-left: 0;"><span>—</span></div>
  141. <div class="from" v-if="commodity.reserve && commodity.reserve>0">
  142. 起拍:<span v-if="commodity.minBuyQty" v-text="commodity.minBuyQty" :title="commodity.minBuyQty">300</span>
  143. </div>
  144. <!--<div class="multiple">
  145. 倍数:<span>1</span>
  146. </div>-->
  147. <div class="can-div-sell" v-if="commodity.reserve" v-text="commodity.breakUp?'可拆卖':'不可拆卖'"></div>
  148. </td>
  149. <td>
  150. <div class="amount">
  151. <div v-for="price in commodity.prices" v-text="price.start + '+'" :title="price.start + '+'"></div>
  152. </div>
  153. <!--<div v-show="commodity.currencyName.indexOf('USD')==-1 || !commodity.prices">
  154. <span>—</span>
  155. </div>
  156. <div v-for="price in commodity.prices">{{price.uSDPrice | currency}}</div>-->
  157. <div class="price">
  158. <div v-show="!commodity.prices || !commodity.prices.length">
  159. <span>—</span>
  160. </div>
  161. <template v-if="commodity.currencyName === 'RMB'">
  162. <div v-for="price in commodity.prices" :title="'¥' + price.rMBPrice">¥{{price.rMBPrice | currency}}</div>
  163. </template>
  164. <template v-else>
  165. <div v-for="price in commodity.prices" :title="'$' + price.uSDPrice">${{price.uSDPrice | currency}}</div>
  166. </template>
  167. </div>
  168. </td>
  169. <td>
  170. <div v-if="commodity.b2cMinDelivery">
  171. <!--{{commodity.b2cMinDelivery || 0}}-{{commodity.b2cMaxDelivery || 0}}天-->
  172. <span v-if="commodity.b2cMinDelivery != commodity.b2cMaxDelivery" v-text="commodity.b2cMinDelivery + '-' + commodity.b2cMaxDelivery" :title="commodity.b2cMinDelivery + '-' + commodity.b2cMaxDelivery"></span>
  173. <span v-if="commodity.b2cMinDelivery == commodity.b2cMaxDelivery" v-text="commodity.b2cMinDelivery" :title="commodity.b2cMinDelivery"></span>
  174. </div>
  175. <div v-if="!commodity.b2cMinDelivery"><span>—</span></div>
  176. </td>
  177. <td>
  178. <div v-if="commodity.attach">
  179. <a @click="goAttach(commodity.attach, $event)" target="_blank"><img src="/images/store/common/pdf.png" alt=""/></a>
  180. </div>
  181. <div v-if="!commodity.attach">—</div>
  182. </td>
  183. <td>
  184. <buy :item="commodity" v-if="commodity.attach"></buy>
  185. <button v-if="!commodity.attach"
  186. style="z-index: 1000;"
  187. class="btn btn-primary btn-buy-now"
  188. :class="{'disabled': isClick}"
  189. @click="immediatelyClick(commodity, $event)">
  190. <span class="watch">立即询价</span>
  191. </button>
  192. </td>
  193. </tr>
  194. <tr class="active-empty" v-if="!commodities.content || commodities.content.length == 0">
  195. <td colspan="10" style="height: 880px;">
  196. <div class="text-center">
  197. <div class="col-xs-offset-3 col-xs-2">
  198. <img src="/images/brandList/empty-cart.jpg">
  199. </div>
  200. <div class="col-xs-4 txt-info">
  201. <!--<p class="grey f16">暂无器件信息</p>-->
  202. <p class="grey f16"> 暂无产品信息</p>
  203. <i class="iconfont" v-if="emptyShow === false">&#xe610;</i>&nbsp;<a v-if="emptyShow === false" href="/">返回首页</a>
  204. <img v-if="emptyShow === true" src="/images/brandList/upload.png">&nbsp;<a v-if="emptyShow === true" href="/vendor#/vendor_upload?type=company" target="_blank">马上去上传</a>
  205. </div>
  206. </div>
  207. </td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. <!--<div class="remind-area">-->
  212. <!--<img src="/images/store/store-remind.png" alt="">-->
  213. <!--所有报价、库存信息的真实性及准确性均由店铺负责,如有疑问请点击-->
  214. <!--<a @click="goLink" class="link-seller">联系卖家</a>-->
  215. <!--</div>-->
  216. <div style="float: right;margin-right: 12px;">
  217. <page :total="commodities.totalElements" :page-size="pageParams.count"
  218. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  219. </div>
  220. <link-saler-box
  221. :tel="tel"
  222. v-if="showLinkBox"
  223. @cancelAction="showLinkBox = false">
  224. </link-saler-box>
  225. </div>
  226. </div>
  227. </div>
  228. </template>
  229. <script>
  230. function getAllLeafIds (kind) {
  231. if (!kind) {
  232. return null
  233. }
  234. if (kind.isLeaf === 1) {
  235. return kind.id
  236. } else {
  237. if (!kind.children || kind.children.length === 0) {
  238. return null
  239. }
  240. let ids = []
  241. for (let i = 0; i < kind.children.length; i++) {
  242. ids.push(getAllLeafIds(kind.children[i]))
  243. }
  244. return ids.join(',')
  245. }
  246. }
  247. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  248. import Page from '~components/common/page/pageComponent.vue'
  249. import LinkSalerBox from '~components/common/LinkSalerBox.vue'
  250. export default {
  251. name: 'commodity-list',
  252. props: ['kinds'],
  253. components: {
  254. Buy,
  255. Page,
  256. LinkSalerBox
  257. },
  258. data () {
  259. return {
  260. isClick: false,
  261. applyObj: {
  262. cmpCode: '',
  263. brand: '',
  264. unitPrice: '',
  265. currency: 'RMB',
  266. prodName: '',
  267. spec: '',
  268. encapsulation: '',
  269. produceDate: '',
  270. amount: '',
  271. deadline: ''
  272. },
  273. validObj: {
  274. unitPrice: true,
  275. amount: true,
  276. deadline: true
  277. },
  278. pickerOptions: {
  279. disabledDate (time) {
  280. // 大于等于今天 小于三个月后
  281. return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
  282. }
  283. },
  284. hasDialog: false,
  285. defaultProps: {
  286. children: 'children',
  287. label: 'nameCn'
  288. },
  289. pageParams: {
  290. page: 1,
  291. count: 10
  292. },
  293. searchCode: '',
  294. parentKindId: 0,
  295. ids: null,
  296. showLinkBox: false,
  297. tel: ''
  298. }
  299. },
  300. filters: {
  301. currency: function (num) {
  302. if (typeof num === 'number') {
  303. if (num <= 0.000001) {
  304. num = 0.000001
  305. } else {
  306. if (num.toString().indexOf('.') === -1) {
  307. num += '.00'
  308. } else {
  309. let inputStr = num.toString()
  310. let arr = inputStr.split('.')
  311. let floatNum = arr[1]
  312. if (floatNum.length > 6) {
  313. num = inputStr.substring(0, arr[0].length + 7)
  314. if (Number(floatNum.charAt(6)) > 4) {
  315. num = (Number(num) * 1000000 + 1) / 1000000
  316. }
  317. } else if (floatNum.length === 1) {
  318. num = num + '0'
  319. }
  320. }
  321. }
  322. }
  323. return num
  324. }
  325. },
  326. computed: {
  327. commodities () {
  328. return this.$store.state.shop.storeInfo.storeCommodity.data
  329. },
  330. storeInfo () {
  331. return this.$store.state.shop.storeInfo.store.data
  332. },
  333. user () {
  334. return this.$store.state.option.user
  335. },
  336. tab () {
  337. return this.$store.state.chat.tab.tab.data
  338. },
  339. isConsignment () {
  340. return this.storeInfo.type === 'CONSIGNMENT'
  341. },
  342. storeStatus () {
  343. return this.$store.state.option.storeStatus.data
  344. },
  345. emptyShow () {
  346. let loggedStatus = false
  347. if (this.user.logged && this.user.data.enterprise.uu) {
  348. if (this.storeStatus.uuid === this.storeInfo.uuid) {
  349. loggedStatus = true
  350. } else {
  351. loggedStatus = false
  352. }
  353. } else {
  354. loggedStatus = false
  355. }
  356. return loggedStatus
  357. },
  358. enterprise () {
  359. let ens = this.user.data.enterprises
  360. if (ens && ens.length) {
  361. return ens.find(item => item.current) || {enName: '个人账户'}
  362. } else {
  363. return {enName: '个人账户'}
  364. }
  365. }
  366. },
  367. watch: {
  368. kinds: {
  369. handler: function (val) {
  370. if (val) {
  371. val.forEach((item) => {
  372. this.KindsNameChange(item)
  373. })
  374. }
  375. },
  376. immediate: true
  377. }
  378. },
  379. // mounted () {
  380. // this.$nextTick(() => {
  381. // this.kinds.forEach((item) => {
  382. // this.KindsNameChange(item)
  383. // })
  384. // })
  385. // },
  386. // mounted () {
  387. // this.kinds.forEach((item) => {
  388. // this.KindsNameChange(item)
  389. // })
  390. // // alert(JSON.stringify(this.kinds))
  391. // },
  392. methods: {
  393. sendprove: function () {
  394. if (this.user.logged) {
  395. if (this.enterprise && this.enterprise.isVendor === 313) {
  396. window.open('/vendor#/vendor_upload')
  397. } else {
  398. this.$router.push('/register-saler')
  399. }
  400. } else {
  401. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  402. }
  403. },
  404. goLink: function () {
  405. this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
  406. },
  407. KindsNameChange: function (obj) {
  408. obj.nameCn += (obj.count ? ` (${obj.count})` : '')
  409. if (obj.children && obj.children.length) {
  410. obj.children.forEach((item) => {
  411. this.KindsNameChange(item)
  412. })
  413. }
  414. },
  415. goAttach: function (url, event) {
  416. event.stopPropagation()
  417. if (this.user.logged) {
  418. if (url && url !== '1') {
  419. window.open(url)
  420. } else {
  421. this.$message.error('规格书地址错误')
  422. }
  423. } else {
  424. this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
  425. if (response.data) {
  426. window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
  427. }
  428. })
  429. }
  430. },
  431. handlerCurrentNode (data, node) {
  432. this.searchCode = ''
  433. if (this.parentKindId === data.id) {
  434. this.parentKindId = 0
  435. this.ids = null
  436. } else {
  437. if (data.level === 1) {
  438. this.parentKindId = data.id
  439. }
  440. this.ids = getAllLeafIds(data)
  441. }
  442. this.pageParams.page = 1
  443. this.pageCommodity(this.pageParams, this.ids)
  444. },
  445. onNodeCollapse () {
  446. this.parentKindId = ''
  447. },
  448. goodsSearch (keyword) {
  449. this.pageParams.page = 1
  450. this.pageCommodity(this.pageParams, this.ids, keyword)
  451. },
  452. async pageCommodity (pageParams, kindId, keyword) {
  453. // pageCommodity (pageParams, kindId, keyword) {
  454. let params = { storeid: this.$route.params.uuid, origin: 'store', kindUuid: kindId, code: keyword }
  455. params.page = pageParams.page
  456. params.count = pageParams.count
  457. try {
  458. let { data } = await this.$http.get('/api/commodity/commodities', { params })
  459. this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', data)
  460. } catch (err) {
  461. this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
  462. }
  463. // this.$http.get('/api/commodity/commodities', { params }).then(response => {
  464. // this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', response)
  465. // }, err => {
  466. // this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
  467. // })
  468. },
  469. handleCurrentChange (page) {
  470. this.pageParams.page = page
  471. this.pageCommodity(this.pageParams, this.ids, this.searchCode)
  472. },
  473. // goBack () {
  474. // this.$router.back(-1)
  475. // }
  476. isSpecificPriceTag: function (tag) {
  477. return tag && tag.indexOf('特价') !== -1
  478. },
  479. goBatchDetail (batchCode) {
  480. window.open('/store/productDetail/' + batchCode)
  481. },
  482. goBrandDetail (url, event) {
  483. event.stopPropagation()
  484. window.open(url)
  485. },
  486. // 格式化字符串长度
  487. spliceString (str, length) {
  488. return str && str.length ? this.baseUtils.spliceStr(str, length) : '暂无信息'
  489. },
  490. // 弹出询价界面
  491. immediatelyClick (type, event) {
  492. event.stopPropagation()
  493. if (!this.user.logged) {
  494. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  495. } else {
  496. this.hasDialog = true
  497. this.applyObj.cmpCode = type.code
  498. this.applyObj.brand = type.brandNameEn
  499. this.applyObj.spec = type.spec
  500. this.applyObj.prodName = type.kindNameCn
  501. }
  502. },
  503. // 时间格式化
  504. setDeadLineValid: function () {
  505. if(this.applyObj.deadline === '') {return ''}
  506. this.applyObj.deadline = this.baseUtils.formatDate(this.baseUtils.getFullDay(new Date(this.applyObj.deadline)), 'yyyy-MM-dd hh:mm:ss')
  507. this.validObj.deadline = true
  508. },
  509. // 检查单价预算
  510. checkUnitPrice () {
  511. this.validObj.unitPrice = this.applyObj.unitPrice === '' ? true : this.applyObj.unitPrice > 0 && this.applyObj.unitPrice < 100000000
  512. if (!this.validObj.unitPrice && this.applyObj.unitPrice <= 0) {
  513. this.$message.error('单价必须是大于0的数字')
  514. }
  515. return this.validObj.unitPrice
  516. },
  517. // 检查采购数量
  518. checkAmount () {
  519. this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 1000000000
  520. return this.validObj.amount
  521. },
  522. // 检查时间是否有输入
  523. checkDeadline () {
  524. this.validObj.deadline = Boolean(this.applyObj.deadline)
  525. return this.validObj.deadline
  526. },
  527. // 检查各个字段输入正常数据
  528. checkAll () {
  529. return this.checkDeadline() && this.checkUnitPrice() && this.checkAmount()
  530. },
  531. emptyForm () {
  532. for (let attr in this.applyObj) {
  533. this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
  534. }
  535. },
  536. // 请求询价信息
  537. goPublish () {
  538. let _this = this
  539. this.isClick = true
  540. setTimeout(function () {
  541. _this.isClick = false
  542. }, 1000)
  543. if (this.checkAll()) {
  544. let inquiry = {}
  545. let inquiryItem = {}
  546. if (this.user.data.enterprise) {
  547. inquiry.enUU = this.user.data.enterprise.uu
  548. }
  549. let date = new Date()
  550. let currency = this.applyObj.unitPrice ? this.applyObj.currency : null
  551. inquiry.recorderUU = this.user.data.userUU
  552. inquiry.code = 'MALL' + date.getTime()
  553. inquiry.date = date
  554. inquiry.recorder = this.user.data.userName
  555. inquiry.endDate = this.applyObj.deadline
  556. inquiry.sourceapp = 'MALL'
  557. inquiry.amount = 1
  558. inquiryItem.userUU = this.user.data.userUU
  559. inquiryItem.source = 'MALL'
  560. inquiryItem.userName = this.user.data.userName
  561. inquiryItem.userTel = this.user.data.userTel
  562. inquiryItem.needquantity = this.applyObj.amount
  563. inquiryItem.inbrand = this.applyObj.brand
  564. inquiryItem.currency = currency
  565. inquiryItem.cmpCode = this.applyObj.cmpCode.toUpperCase()
  566. inquiryItem.unitPrice = this.applyObj.unitPrice
  567. inquiryItem.produceDate = this.applyObj.produceDate
  568. inquiryItem.date = date
  569. inquiryItem.endDate = this.applyObj.deadline
  570. inquiryItem.encapsulation = this.applyObj.encapsulation
  571. inquiryItem.spec = this.applyObj.spec
  572. inquiryItem.prodTitle = this.applyObj.prodName
  573. let inquiryItems = []
  574. inquiryItems.push(inquiryItem)
  575. inquiry.inquiryItems = inquiryItems
  576. inquiry.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
  577. this.$http.post('/inquiry/buyer/save', inquiry)
  578. .then(res => {
  579. this.$message.success('发布成功')
  580. this.hasDialog = false
  581. this.emptyForm()
  582. }, error => {
  583. console.log(error)
  584. this.$message.error('发布失败')
  585. })
  586. } else {
  587. if (!this.validObj.deadline) {
  588. this.$message.error('截止日期不能为空')
  589. } else if (!this.validObj.amount) {
  590. this.$message.error('请输入正确的数值')
  591. }
  592. }
  593. }
  594. }
  595. }
  596. </script>
  597. <style type="text/scss" lang="scss">
  598. #goods-list-fragment {
  599. .btn-buy-now {
  600. background-color: #5078CB;
  601. color: #fff;
  602. width: 80px;
  603. height: 30px;
  604. font-size: 12px;
  605. border: 1px solid #5078cb;
  606. position: relative;
  607. }
  608. .btn-add-cart {
  609. margin-top: 10px;
  610. color: #214797;
  611. width: 80px;
  612. height: 30px;
  613. font-size: 12px;
  614. background-color: #fff;
  615. border: 1px solid #e8e8e8;
  616. }
  617. .btn-buy-now:hover{
  618. background: #214797;
  619. }
  620. .btn-buy-now.disabled,
  621. .btn-buy-now.disabled:focus{
  622. background-color: #d1d2d3!important;
  623. border: none!important;
  624. outline: none;
  625. color: #fff!important;
  626. cursor: not-allowed;
  627. }
  628. .el-dialog{
  629. width: 680px!important;
  630. .el-dialog__header{
  631. background: #4290f7;
  632. line-height: 40px;
  633. padding: 0 20px 0;
  634. display:block;
  635. .el-dialog__title{
  636. color:#fff;
  637. }
  638. .el-dialog__headerbtn:hover .el-dialog__close, .el-dialog__headerbtn:focus .el-dialog__close{
  639. color:#fff;
  640. }
  641. }
  642. .el-dialog__body{
  643. padding: 10px 20px;
  644. }
  645. .el-dialog__footer{
  646. text-align: center;
  647. button{
  648. display:inline-block;
  649. background: #3c7cf5;
  650. color:#fff;
  651. font-size: 14px;
  652. line-height: 30px;
  653. height:30px;
  654. padding:0 10px;
  655. box-shadow: none;
  656. border: 0;
  657. border-radius:5px;
  658. }
  659. }
  660. }
  661. .form_dialog{
  662. .el-date-editor--date{
  663. width: 230px;
  664. &.error {
  665. input {
  666. border: 1px solid #f4645f !important;
  667. }
  668. }
  669. }
  670. ul{
  671. li{
  672. width:50%;
  673. font-size: 14px;
  674. color:#666;
  675. vertical-align: top;
  676. margin-bottom:15px;
  677. &.form-item {
  678. position: relative;
  679. p{
  680. margin:0;
  681. margin-left:80px;
  682. word-break: break-all;
  683. word-wrap: break-word;
  684. }
  685. span {
  686. float:left;
  687. width: 112px;
  688. text-align: right;
  689. display: inline-block;
  690. color:#3c7cf5;
  691. i {
  692. position: relative;
  693. top: 2px;
  694. right: 5px;
  695. color: #e41515;
  696. }
  697. }
  698. ul {
  699. line-height: normal;
  700. position: absolute;
  701. top: 19px;
  702. left: 79px;
  703. background: #fff;
  704. border: 1px solid #b5b5b5;
  705. z-index: 1;
  706. max-height: 120px;
  707. overflow-y: auto;
  708. overflow-x: hidden;
  709. border-radius: 3px;
  710. width: 114px;
  711. font-size: 12px;
  712. li {
  713. height: 24px;
  714. line-height: 24px;
  715. cursor: pointer;
  716. overflow: hidden;
  717. text-overflow: ellipsis;
  718. white-space: nowrap;
  719. padding: 0 5px;
  720. &:hover {
  721. background: #ddd;
  722. }
  723. }
  724. }
  725. select {
  726. width: 40px;
  727. position: absolute;
  728. height: 20px;
  729. background: url('/images/applyPurchase/select.png')no-repeat right;
  730. background-position-x: 23px;
  731. padding: 0 0 0 7px;
  732. border-radius: 0;
  733. & + input {
  734. padding-left: 45px;
  735. }
  736. }
  737. .el-input {
  738. width: 198px;
  739. }
  740. input {
  741. font-size: 14px;
  742. width: 198px;
  743. height: 20px;
  744. line-height: 20px;
  745. border-radius: 2px;
  746. padding: 0 3px;
  747. box-shadow: none;
  748. -webkit-box-shadow: none;
  749. -moz-box-shadow: none;
  750. &.error {
  751. border-color: #f4645f!important;
  752. }
  753. }
  754. }
  755. }
  756. }
  757. }
  758. }
  759. #goods-list-fragment{
  760. width: 100%;
  761. background: #ece9ec;
  762. /*padding-top: 20px;*/
  763. }
  764. #goods-list-fragment .container{
  765. width: 965px;
  766. padding: 0;
  767. /*height: 738px;*/
  768. background: #ece9ec;
  769. }
  770. /* 产品分类调整*/
  771. #goods-list-fragment .category-content{
  772. max-height: 496px;
  773. min-height: 224px;
  774. overflow-y: scroll;
  775. overflow-x: hidden;
  776. position: relative;
  777. }
  778. #goods-list-fragment .category-content .empty{
  779. display: block;
  780. width: 56px;
  781. height: 16px;
  782. position: absolute;
  783. top: 50%;
  784. left: 50%;
  785. transform: translate(-28px, -8px);
  786. color: #5e7382;
  787. }
  788. .category-content el-tree{
  789. /*border: none;*/
  790. }
  791. .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content,.el-tree-node:hover{
  792. background: none !important;
  793. }
  794. .el-tree-node__content:hover{
  795. background: none !important;
  796. }
  797. .el-tree-node__content:hover span{
  798. color: #3c7df3;
  799. }
  800. .el-tree-node__content:hover span:last-child {
  801. /*text-decoration: underline;*/
  802. }
  803. .el-pagination .el-pager li.active{
  804. background-color: #5078cb;
  805. border-color: #337ab7;
  806. }
  807. .el-tree-node__expand-icon{
  808. margin-left: 3px;
  809. font-family: "iconfont" !important;
  810. font-size: 14px;
  811. font-style: normal;
  812. -webkit-font-smoothing: antialiased;
  813. width: inherit;
  814. height: inherit;
  815. border: inherit;
  816. font-weight: bold;
  817. text-shadow: -1px 0px 0 #333;
  818. margin-right: 3px !important;
  819. }
  820. .el-tree-node__content{
  821. line-height: 30px;
  822. height: 30px;
  823. }
  824. .el-tree-node__expand-icon.is-leaf{
  825. visibility: hidden;
  826. }
  827. .el-tree-node__expand-icon:before{
  828. content: "\E621";
  829. }
  830. #goods-list-fragment .category-title {
  831. height: 34px;
  832. background-color: #3c7df5;
  833. font-size: 16px;
  834. color: rgb(255,255,255);
  835. text-align: center;
  836. border-radius: 5px;
  837. }
  838. #goods-list-fragment .category-content li {
  839. line-height: 33px;
  840. font-size: 14px;
  841. color: #333;
  842. float: left;
  843. width: 100%;
  844. padding-left: 10px;
  845. }
  846. #goods-list-fragment .category-content li a {
  847. display: block;
  848. padding-left: 15px;
  849. text-decoration: none;
  850. color: #333;
  851. /* background:url("static/img/store/default/openblackR.png") no-repeat left; */
  852. }
  853. #goods-list-fragment .category-content li a:hover{
  854. color: #5078cb;
  855. cursor: pointer;
  856. }
  857. #goods-list-fragment .category-content ul.list-body {
  858. display: none;
  859. color: #666;
  860. }
  861. #goods-list-fragment .category-content ul.list-body.active {
  862. display: block;
  863. }
  864. #goods-list-fragment .category-content ul.list-body li {
  865. float: none;
  866. background-image: none;
  867. min-height: 26px;
  868. line-height: 26px;
  869. font-size: 12px;
  870. }
  871. #goods-list-fragment .category-content ul.list-body li a {
  872. padding-left: 15px;
  873. display: block;
  874. color: rgb(50,50,50);
  875. background: none;
  876. }
  877. #goods-list-fragment .category-content ul.list-body li a:hover {
  878. color: #5078cb;
  879. cursor: pointer;
  880. }
  881. #goods-list-fragment .category-content ul.list-body li a.cur {
  882. text-decoration: none;
  883. font-size: 14px;
  884. /* background:url("static/img/store/default/openblackR.png") no-repeat left; */
  885. }
  886. #goods-list-fragment .title-area {
  887. margin-bottom: 30px;
  888. width: 250px;
  889. float: left;
  890. background: #fff;
  891. }
  892. #goods-list-fragment .category-content{
  893. border: 1px solid #e8e8e8;
  894. }
  895. /* goods-area */
  896. #goods-list-fragment .goods-area {
  897. /*margin-left: 3px;*/
  898. float: left;
  899. /*margin-bottom: 30px;*/
  900. background: #fff;
  901. margin: 0 auto 24px;
  902. height: 914px;
  903. }
  904. #goods-list-fragment .goods-area .btn-line {
  905. border-radius: 0;
  906. }
  907. #goods-list-fragment .btn-info.btn-line {
  908. background-color: #5078CB;
  909. color: #fff;
  910. font-weight: 600;
  911. }
  912. #goods-list-fragment .btn-line {
  913. height: 34px;
  914. width: 150px;
  915. border: 1px solid #5078cb;
  916. background-color: #fff;
  917. color: rgb(80,120,203);
  918. font-weight: 600;
  919. }
  920. #goods-list-fragment .btn-line:hover {
  921. background-color: #5078CB;
  922. color: #fff;
  923. }
  924. /* 物品列表 */
  925. #goods-list-fragment .goodslist .brand-code {
  926. font-size: 12px;
  927. text-align: center;
  928. position: relative;
  929. }
  930. #goods-list-fragment #search_btn {
  931. background: #2496f1;
  932. color: #FFF;
  933. border-bottom-right-radius: 3px;
  934. border-top-right-radius: 3px;
  935. border-bottom-left-radius: 0px;
  936. border-top-left-radius: 0px;
  937. height: 28px;
  938. width: 69px;
  939. padding-right: 50px;
  940. }
  941. #goods-list-fragment .sendprove {
  942. width: 110px;
  943. height: 28px;
  944. color: #2496f1;
  945. font-size: 14px;
  946. background-color: #fff;
  947. border-radius: 3px;
  948. float: right;
  949. margin-left: 10px;
  950. border: 1px solid #2496f1;
  951. }
  952. #goods-list-fragment .sendprove:hover{
  953. background-color: #2496f1;
  954. border-color: #2496f1;
  955. color: #fff;
  956. }
  957. .btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus {
  958. outline: none;
  959. border-color: transparent;
  960. }
  961. #goods-list-fragment #search_input {
  962. font-size: 14px;
  963. height: 28px;
  964. line-height: 28px;
  965. width: 189px;
  966. float: right;
  967. border-bottom-left-radius: 3px;
  968. border-top-left-radius: 3px;
  969. border: 1px solid #2496f1;
  970. }
  971. #goods-list-fragment .brand-code .code {
  972. font-weight: 600;
  973. word-break: break-all;
  974. overflow: hidden;
  975. text-overflow: ellipsis;
  976. display: -webkit-box;
  977. -webkit-line-clamp: 2;
  978. -webkit-box-orient: vertical;
  979. }
  980. #goods-list-fragment .brand-code .spec {
  981. word-break: break-all;
  982. overflow: hidden;
  983. text-overflow: ellipsis;
  984. display: -webkit-box;
  985. -webkit-line-clamp: 2;
  986. -webkit-box-orient: vertical;
  987. }
  988. #goods-list-fragment .brand-code .brand a {
  989. color: #2496f1;
  990. }
  991. #goods-list-fragment .brand-code .brand span{
  992. color: #2496f1;
  993. word-break: break-all;
  994. overflow: hidden;
  995. text-overflow: ellipsis;
  996. display: -webkit-box;
  997. -webkit-line-clamp: 2;
  998. -webkit-box-orient: vertical;
  999. }
  1000. #goods-list-fragment .goodslist thead tr{
  1001. background-color: #2496f1;
  1002. height: 34px;
  1003. }
  1004. #goods-list-fragment .goodslist tr th {
  1005. color: #fefefe;
  1006. font-size: 13px;
  1007. }
  1008. #goods-list-fragment .goodslist tr th:first-child{
  1009. border-top-left-radius: 5px;
  1010. border-bottom-left-radius: 5px;
  1011. }
  1012. #goods-list-fragment .goodslist tr th:last-child{
  1013. border-top-right-radius: 5px;
  1014. border-bottom-right-radius: 5px;
  1015. }
  1016. #goods-list-fragment .goodslist tr th div{
  1017. text-align: center;
  1018. border-right: 1px solid #fff;
  1019. }
  1020. #goods-list-fragment .goodslist tr th:last-child div{
  1021. border-right: none;
  1022. }
  1023. #goodslist-content .goods,#goodslist-content .from, #goodslist-content .can-div-sell {
  1024. padding-left: 20px;
  1025. }
  1026. #goodslist-content .goods span{
  1027. /*color: #f01010;*/
  1028. }
  1029. #goodslist-content .amount {
  1030. width: 50%;
  1031. float: left;
  1032. padding-left: 30px;
  1033. text-align:left;
  1034. }
  1035. #goodslist-content .amount div{
  1036. overflow: hidden;
  1037. text-overflow: ellipsis;
  1038. white-space: nowrap;
  1039. }
  1040. #goodslist-content .amount div:last-child{
  1041. /*color: #f01010;*/
  1042. }
  1043. #goodslist-content .price {
  1044. width: 50%;
  1045. float:right;
  1046. text-align:left;
  1047. }
  1048. #goodslist-content .price div {
  1049. overflow: hidden;
  1050. text-overflow: ellipsis;
  1051. white-space: nowrap;
  1052. }
  1053. #goodslist-content .price div:last-child{
  1054. color: #f01010;
  1055. }
  1056. #goods-list-fragment .category-content a.selected-node,
  1057. #goods-list-fragment .category-content ul.list-body li a.selected-node {
  1058. color: #5078cb;
  1059. }
  1060. #goods-list-fragment .category-content a.selected-parent-node,
  1061. #goods-list-fragment .category-content ul.list-body li a.selected-parent-node {
  1062. /* background:url("static/img/store/default/openblack.png") no-repeat left; */
  1063. }
  1064. #goods-list-fragment .goodslist tbody>tr:hover{
  1065. background: #ecf2fd;
  1066. }
  1067. #goods-list-fragment .goodslist tbody>tr {
  1068. border: 1px solid #e8e8e8;
  1069. }
  1070. #goods-list-fragment .goodslist tbody>tr td.commodity-icon .img{
  1071. border: 1px solid #e8e8e8;
  1072. margin: 10px;
  1073. width: 80px;
  1074. height: 80px;
  1075. overflow: hidden;
  1076. line-height: 75px;
  1077. }
  1078. #goods-list-fragment .goodslist tbody>tr td.commodity-icon .img>img {
  1079. width: 80px;
  1080. height: 80px;
  1081. }
  1082. #goods-list-fragment .goodslist tbody>tr td.brand-code .sellout-store-commodity {
  1083. position: absolute;
  1084. right: 0;
  1085. bottom: 0;
  1086. }
  1087. #goods-list-fragment .goodslist tbody>tr td.brand-code .specific-price-tag {
  1088. position: absolute;
  1089. top: 0;
  1090. left: 0;
  1091. }
  1092. #goods-list-fragment .goodslist td {
  1093. font-size: 12px;
  1094. color: #333;
  1095. text-align: center;
  1096. line-height: 20px;
  1097. height: 88px;
  1098. }
  1099. #goods-list-fragment .goodslist tbody>tr td .can-div-sell {
  1100. color: #333;
  1101. }
  1102. /* 物品列表按钮 */
  1103. #goods-list-fragment .btn-buy-now {
  1104. background-color: #2496f1;
  1105. color: #fff;
  1106. width: 80px;
  1107. height: 24px;
  1108. font-size: 12px;
  1109. border: 1px solid #2496f1;
  1110. border-radius: 2px;
  1111. }
  1112. #goods-list-fragment .btn-add-cart {
  1113. margin-top: 10px;
  1114. color: #2496f1;
  1115. width: 80px;
  1116. height: 24px;
  1117. font-size: 12px;
  1118. background-color: #fff;
  1119. border-radius: 2px;
  1120. border: 1px solid #2496f1;
  1121. }
  1122. #goods-list-fragment .btn-buy-now:hover{
  1123. background: #1278c7;
  1124. border: 1px solid #1278c7;
  1125. }
  1126. #goods-list-fragment .btn-add-cart:hover{
  1127. background-color: #1278c7;
  1128. color: #fff;
  1129. }
  1130. .no-record{
  1131. font-size: 14px;
  1132. color: #999;
  1133. text-align: center;
  1134. line-height: 200px;
  1135. }
  1136. .no-record i{
  1137. margin-right: 5px;
  1138. }
  1139. .active-empty:hover{
  1140. background-color: #fff!important;
  1141. }
  1142. .text-center{
  1143. text-align: center;
  1144. margin-top: 30px;
  1145. }
  1146. .text-center .col-xs-2 img{
  1147. margin: 55px 0 85px 135px;
  1148. vertical-align: middle;
  1149. }
  1150. .text-center .txt-info{
  1151. font-size: 14px;
  1152. margin: 50px 0px 0px -50px;
  1153. }
  1154. .text-center .col-xs-4 p{
  1155. color: #999;
  1156. margin: 11px 0px 4px -6px;
  1157. }
  1158. .text-center .txt-info i{
  1159. color: #5078cb;
  1160. }
  1161. .text-center .txt-info a{
  1162. font-size: 14px;
  1163. color: #5078cb;
  1164. }
  1165. .text-center .col-xs-5 img{
  1166. margin-left: -235px;
  1167. }
  1168. .goodslist{
  1169. margin-bottom: 24px;
  1170. }
  1171. .remind-area {
  1172. position: absolute;
  1173. top: 1005px;
  1174. }
  1175. .remind-area img {
  1176. margin-right: 12px;
  1177. }
  1178. .remind-area .link-seller {
  1179. font-size: 12px;
  1180. color: #fff;
  1181. line-height: 20px;
  1182. height: 20px;
  1183. padding: 0 7px;
  1184. background: #2496f1;
  1185. border-radius: 2px;
  1186. }
  1187. @font-face {
  1188. font-family: 'iconfont'; /* project id 357960 */
  1189. src: url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.eot');
  1190. src: url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.eot?#iefix') format('embedded-opentype'),
  1191. url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.woff') format('woff'),
  1192. url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.ttf') format('truetype'),
  1193. url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.svg#iconfont') format('svg');
  1194. }
  1195. /*-- 分页 --*/
  1196. #goods-list-fragment .el-pagination .el-pager li.active {
  1197. border-color: #5078cb !important;
  1198. background-color: #5078cb !important;
  1199. }
  1200. #goods-list-fragment .goods-area div>.page-wrap{
  1201. margin: 0;
  1202. }
  1203. </style>