details.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <div class="details_info">
  3. <div class="container">
  4. <div class="crumbs">
  5. <div class="container">
  6. <div class="menu-com row">
  7. <div class="menu-title col-md-12">
  8. <nuxt-link to="/">首页 ></nuxt-link>
  9. <nuxt-link to="/supplier">供应商资源 ></nuxt-link>
  10. <nuxt-link :to="'/supplier/' + uuid">供应商物料库 ></nuxt-link>
  11. <span>物料详情</span>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="top">
  17. <div class="img">
  18. <img :src="detail.cmpImg || '/images/store/common/default.png'">
  19. </div>
  20. <div class="right">
  21. <h4 v-text="detail.cmpCode">3</h4>
  22. <ul class="list-unstyled">
  23. <li class="item">
  24. <span>物料名称</span>
  25. <p v-text="detail.kind ? spliceString(detail.kind, 135) : detail.prodName ? spliceString(detail.prodName, 135) : '暂无信息'">1</p>
  26. </li>
  27. <li class="item">
  28. <span>品牌</span>
  29. <p v-text="detail.standard !== 1 ? detail.brand : detail.pbranden">2</p>
  30. </li>
  31. <li class="item">
  32. <span>库存(PCS)</span>
  33. <p v-text="detail.erpReserve ? detail.erpReserve : 0">32</p>
  34. </li>
  35. <li class="item">
  36. <span>规格</span>
  37. <p v-text="detail.spec ? detail.spec : '暂无信息'">32</p>
  38. </li>
  39. </ul>
  40. <a @click="immediatelyClick">立即询价</a>
  41. </div>
  42. </div>
  43. <div class="detail">
  44. <div class="info_title">
  45. <p>产品参数<span>(仅供参考,以实际产品为准)</span></p> <a v-if="detail.cmpUuId && cmpInfo.properties && cmpInfo.properties.length > 6" @click="hasDown = !hasDown">{{hasDown ? '更多' : '收起'}} <i class="el-icon-arrow-down" v-if="hasDown"></i> <i v-if="!hasDown" class="el-icon-arrow-up"></i></a>
  46. </div>
  47. <div class="empty" v-if="!detail.cmpUuId || (cmpInfo.properties && cmpInfo.properties.length === 0)">
  48. <img src="/images/supplier/icon/empty.png">
  49. <div class="info">
  50. <p>产品暂无参数</p>
  51. <a href="javascript:history.go(-1)"><i class="fa fa-reply" style="margin-right:5px;"></i>返回上一页</a>
  52. </div>
  53. </div>
  54. <ul class="list-unstyled" :style="hasDown ? height300 : heightAuto">
  55. <li v-if="detail.cmpUuId" v-for="item in cmpInfo.properties"><span v-text="item.property.labelCn"></span><span v-text="item.value ? item.value : '-'"></span></li>
  56. </ul>
  57. </div>
  58. </div>
  59. <el-dialog
  60. title="我要询价"
  61. :visible.sync="hasDialog ">
  62. <div class="form_dialog">
  63. <ul class="list-inline">
  64. <li class="form-item">
  65. <span>品牌:</span>
  66. <p v-text="detail.standard !== 1 ? spliceString(detail.brand, 90) : spliceString(detail.pbranden, 90)">2</p>
  67. </li>
  68. <li class="form-item">
  69. <span>物料名称:</span>
  70. <p v-text="detail.kind ? spliceString(detail.kind, 90) : detail.prodName ? spliceString(detail.prodName, 90) : '-'">1</p>
  71. </li>
  72. <li class="form-item">
  73. <span>型号:</span>
  74. <p v-text="detail.cmpCode ? spliceString(detail.cmpCode, 90) : '-'">3</p>
  75. </li>
  76. <li class="form-item">
  77. <span>规格:</span>
  78. <p v-text="detail.spec ? spliceString(detail.spec, 90) : '-'">3</p>
  79. </li>
  80. <li class="form-item">
  81. <span><i>*</i>截止日期:</span>
  82. <el-date-picker
  83. :class="{'error': !validObj.deadline}"
  84. v-model="applyObj.deadline"
  85. type="date"
  86. :picker-options="pickerOptions"
  87. @change="setDeadLineValid"
  88. :editable="false"
  89. :clearable="true"
  90. size="mini">
  91. </el-date-picker>
  92. </li>
  93. <li class="form-item">
  94. <span>封装:</span>
  95. <input type="text" class="form-control" v-model="applyObj.encapsulation"/>
  96. </li>
  97. <!--<li class="form-item">-->
  98. <!--<span>单价预算:</span>-->
  99. <!--<select v-model="applyObj.currency" class="form-control" style="width:40px;">-->
  100. <!--<option value="RMB">¥</option>-->
  101. <!--<option value="USD">$</option>-->
  102. <!--</select>-->
  103. <!--<input type="number" v-model="applyObj.unitPrice" class="form-control" :class="{'error': !validObj.unitPrice}"/>-->
  104. <!--</li>-->
  105. <!--<li class="form-item">-->
  106. <!--<span>生产日期:</span>-->
  107. <!--<input type="text" class="form-control" v-model="applyObj.produceDate"/>-->
  108. <!--</li>-->
  109. <li class="form-item">
  110. <span>采购数量(PCS):</span>
  111. <input type="number" class="form-control" v-model="applyObj.amount" :class="{'error': !validObj.amount}"/>
  112. </li>
  113. </ul>
  114. </div>
  115. <span slot="footer" class="dialog-footer">
  116. <button @click="authorityInterceptor(baseUrls.userPublishSeek, goPublish)" :disabled="isClick">询价提交</button>
  117. </span>
  118. </el-dialog>
  119. </div>
  120. </template>
  121. <script>
  122. export default {
  123. name: 'DetailsView',
  124. data () {
  125. return {
  126. uuid: this.$route.params.uuid,
  127. isClick: false,
  128. hasDown: true,
  129. height300: {
  130. maxHeight: '204px'
  131. },
  132. heightAuto: {
  133. height: 'auto'
  134. },
  135. applyObj: {
  136. unitPrice: '',
  137. currency: 'RMB',
  138. encapsulation: '',
  139. produceDate: '',
  140. amount: '',
  141. deadline: ''
  142. },
  143. validObj: {
  144. unitPrice: true,
  145. amount: true,
  146. deadline: true
  147. },
  148. pickerOptions: {
  149. disabledDate (time) {
  150. // 大于等于今天 小于三个月后
  151. return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
  152. }
  153. },
  154. hasDialog: false,
  155. searchCode: ''
  156. }
  157. },
  158. computed: {
  159. detail () {
  160. return this.$store.state.supplier.detail.detail.data
  161. },
  162. cmpInfo () {
  163. return this.$store.state.supplier.detail.cmpInfo.data
  164. },
  165. user () {
  166. return this.$store.state.option.user
  167. }
  168. },
  169. methods: {
  170. spliceString (str, length) {
  171. return this.baseUtils.spliceStr(str, length)
  172. },
  173. // 弹出询价界面
  174. immediatelyClick () {
  175. if (!this.user.logged) {
  176. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  177. } else {
  178. this.hasDialog = true
  179. }
  180. },
  181. // 时间格式化
  182. setDeadLineValid: function () {
  183. this.applyObj.deadline = this.baseUtils.formatDate(this.baseUtils.getFullDay(new Date(this.applyObj.deadline)), 'yyyy-MM-dd hh:mm:ss')
  184. this.validObj.deadline = true
  185. },
  186. // 检查单价预算
  187. checkUnitPrice () {
  188. this.validObj.unitPrice = this.applyObj.unitPrice === '' ? true : this.applyObj.unitPrice > 0 && this.applyObj.unitPrice < 100000000
  189. if (!this.validObj.unitPrice && this.applyObj.unitPrice <= 0) {
  190. this.$message.error('单价必须是大于0的数字')
  191. }
  192. return this.validObj.unitPrice
  193. },
  194. // 检查采购数量
  195. checkAmount () {
  196. this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 1000000000
  197. return this.validObj.amount
  198. },
  199. // 检查时间是否有输入
  200. checkDeadline () {
  201. this.validObj.deadline = Boolean(this.applyObj.deadline)
  202. return this.validObj.deadline
  203. },
  204. // 检查各个字段输入正常数据
  205. checkAll () {
  206. return this.checkDeadline() && this.checkUnitPrice() && this.checkAmount()
  207. },
  208. emptyForm () {
  209. for (let attr in this.applyObj) {
  210. this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
  211. }
  212. },
  213. // 请求询价信息
  214. goPublish () {
  215. let _this = this
  216. this.isClick = true
  217. setTimeout(function () {
  218. _this.isClick = false
  219. }, 1000)
  220. if (this.checkAll()) {
  221. let inquiry = {}
  222. let inquiryItem = {}
  223. if (this.user.data.enterprise) {
  224. inquiry.enUU = this.user.data.enterprise.uu
  225. }
  226. let date = new Date()
  227. let currency = this.applyObj.unitPrice ? this.applyObj.currency : null
  228. inquiry.recorderUU = this.user.data.userUU
  229. inquiry.code = 'MALL' + date.getTime()
  230. inquiry.date = date
  231. inquiry.recorder = this.user.data.userName
  232. inquiry.endDate = this.applyObj.deadline
  233. inquiry.sourceapp = 'MALL'
  234. inquiry.amount = 1
  235. inquiryItem.userUU = this.user.data.userUU
  236. inquiryItem.source = 'MALL'
  237. inquiryItem.userName = this.user.data.userName
  238. inquiryItem.userTel = this.user.data.userTel
  239. inquiryItem.needquantity = this.applyObj.amount
  240. inquiryItem.inbrand = this.detail.brand
  241. inquiryItem.currency = currency
  242. inquiryItem.cmpCode = this.detail.cmpCode.toUpperCase()
  243. inquiryItem.unitPrice = this.applyObj.unitPrice
  244. inquiryItem.produceDate = this.applyObj.produceDate
  245. inquiryItem.date = date
  246. inquiryItem.endDate = this.applyObj.deadline
  247. inquiryItem.encapsulation = this.applyObj.encapsulation
  248. inquiryItem.spec = this.detail.spec
  249. inquiryItem.prodTitle = this.detail.prodName
  250. let inquiryItems = []
  251. inquiryItems.push(inquiryItem)
  252. inquiry.inquiryItems = inquiryItems
  253. inquiry.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
  254. this.$http.post('/inquiry/buyer/save', inquiry)
  255. .then(res => {
  256. this.$message.success('发布成功')
  257. this.hasDialog = false
  258. this.emptyForm()
  259. }, error => {
  260. console.log(error)
  261. this.$message.error('发布失败')
  262. })
  263. } else {
  264. if (!this.validObj.deadline) {
  265. this.$message.error('截止日期不能为空')
  266. } else if (!this.validObj.amount) {
  267. this.$message.error('请输入正确的数值')
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </script>
  274. <style type="text/scss" lang="scss">
  275. .details_info{
  276. background: #fff;
  277. .el-dialog{
  278. width: 680px!important;
  279. .el-dialog__header{
  280. background: #4290f7;
  281. line-height: 40px;
  282. padding: 0 20px 0;
  283. display:block;
  284. .el-dialog__title{
  285. color:#fff;
  286. }
  287. .el-dialog__headerbtn:hover .el-dialog__close, .el-dialog__headerbtn:focus .el-dialog__close{
  288. color:#fff;
  289. }
  290. }
  291. .el-dialog__body{
  292. padding: 10px 20px;
  293. }
  294. .el-dialog__footer{
  295. text-align: center;
  296. button{
  297. display:inline-block;
  298. border:0;
  299. box-shadow: none;
  300. background: #3c7cf5;
  301. color:#fff;
  302. font-size: 14px;
  303. line-height: 30px;
  304. height:30px;
  305. padding:0 10px;
  306. border-radius:5px;
  307. }
  308. }
  309. }
  310. .form_dialog{
  311. .el-date-editor--date {
  312. width: 230px;
  313. &.error {
  314. input {
  315. border: 1px solid #f4645f !important;
  316. }
  317. }
  318. }
  319. ul{
  320. li{
  321. width:50%;
  322. font-size: 14px;
  323. color:#666;
  324. vertical-align: top;
  325. margin-bottom:15px;
  326. &.form-item {
  327. position: relative;
  328. p{
  329. margin:0;
  330. margin-left:80px;
  331. word-break: break-all;
  332. word-wrap: break-word;
  333. }
  334. span {
  335. float:left;
  336. width: 112px;
  337. text-align: right;
  338. display: inline-block;
  339. color:#3c7cf5;
  340. i {
  341. position: relative;
  342. top: 2px;
  343. right: 5px;
  344. color: #e41515;
  345. }
  346. }
  347. ul {
  348. line-height: normal;
  349. position: absolute;
  350. top: 19px;
  351. left: 79px;
  352. background: #fff;
  353. border: 1px solid #b5b5b5;
  354. z-index: 1;
  355. max-height: 120px;
  356. overflow-y: auto;
  357. overflow-x: hidden;
  358. border-radius: 3px;
  359. width: 114px;
  360. font-size: 12px;
  361. li {
  362. height: 24px;
  363. line-height: 24px;
  364. cursor: pointer;
  365. overflow: hidden;
  366. text-overflow: ellipsis;
  367. white-space: nowrap;
  368. padding: 0 5px;
  369. &:hover {
  370. background: #ddd;
  371. }
  372. }
  373. }
  374. select {
  375. width: 40px;
  376. position: absolute;
  377. height: 20px;
  378. background: url('/images/applyPurchase/select.png')no-repeat right;
  379. background-position-x: 23px;
  380. padding: 0 0 0 7px;
  381. border-radius: 0;
  382. & + input {
  383. padding-left: 45px;
  384. }
  385. }
  386. .el-input {
  387. width: 198px;
  388. }
  389. input {
  390. font-size: 14px;
  391. width: 198px;
  392. height: 20px;
  393. line-height: 20px;
  394. border-radius: 2px;
  395. padding: 0 3px;
  396. box-shadow: none;
  397. -webkit-box-shadow: none;
  398. -moz-box-shadow: none;
  399. &.error {
  400. border-color: #f4645f!important;
  401. }
  402. }
  403. }
  404. }
  405. }
  406. }
  407. .crumbs{
  408. background: #fff;
  409. .menu-com{
  410. margin: 0;
  411. .menu-title{
  412. line-height: 40px;
  413. font-size: 14px;
  414. padding-left: 0;
  415. margin:0;
  416. a{
  417. color: #5078cb;
  418. font-size: 14px;
  419. }
  420. }
  421. }
  422. }
  423. .top{
  424. margin-bottom:20px;
  425. .img{
  426. float:left;
  427. width:350px;
  428. height:350px;
  429. vertical-align: top;
  430. padding:36px;
  431. border:1px solid #bababa;
  432. img{
  433. width:100%;
  434. height:100%;
  435. }
  436. }
  437. .right{
  438. position:relative;
  439. height:350px;
  440. margin-left:370px;
  441. h4{
  442. width:800px;
  443. font-size: 25px;
  444. line-height: 25px;
  445. font-weight: bold;
  446. overflow: hidden;
  447. text-overflow: ellipsis;
  448. white-space:nowrap;
  449. border-bottom:1px solid #3c7cf5;
  450. margin:0;
  451. padding-bottom:20px;
  452. }
  453. a{
  454. display:inline-block;
  455. position:absolute;
  456. bottom:0;
  457. left: 0;
  458. background: #3c7cf5;
  459. color:#fff;
  460. font-size: 14px;
  461. line-height: 30px;
  462. height:30px;
  463. padding:0 10px;
  464. border-radius:5px;
  465. }
  466. ul{
  467. padding-top:35px;
  468. li{
  469. margin-bottom:25px;
  470. span{
  471. display: inline-block;
  472. width: 100px;
  473. float: left;
  474. color: #3c7cf5;
  475. vertical-align: top;
  476. text-align: right;
  477. margin-right: 15px;
  478. }
  479. p{
  480. width:365px;
  481. font-size: 14px;
  482. color:#333;
  483. margin:0;
  484. margin-left:90px;
  485. word-wrap: break-word;
  486. word-break: normal;
  487. }
  488. }
  489. }
  490. }
  491. }
  492. .detail{
  493. margin-bottom:90px;
  494. border:1px solid #e5e5e5;
  495. .empty {
  496. padding:75px 0;
  497. text-align: center;
  498. img {
  499. vertical-align: top;
  500. margin-right: 15px;
  501. }
  502. .info {
  503. display: inline-block;
  504. padding-top: 10px;
  505. }
  506. }
  507. .info_title{
  508. position:relative;
  509. line-height: 34px;
  510. font-weight: bold;
  511. color:#fff;
  512. background: #3c7cf5;
  513. padding-left:15px;
  514. text-align: left;
  515. p{
  516. font-size: 16px;
  517. margin:0;
  518. span{
  519. font-size: 12px;
  520. }
  521. }
  522. a{
  523. position:absolute;
  524. top:0;
  525. right:20px;
  526. color:#fff;
  527. }
  528. }
  529. ul{
  530. margin-left:0;
  531. overflow: hidden;
  532. li{
  533. line-height: 34px;
  534. text-align: center;
  535. overflow: hidden;
  536. > span{
  537. display:inline-block;
  538. width:50%;
  539. }
  540. &:nth-child(odd){
  541. background: #fff;
  542. }
  543. &:nth-child(even){
  544. background: #f5f6f8;
  545. }
  546. &.empty{
  547. padding: 100px 0;
  548. font-size: 24px;
  549. }
  550. }
  551. }
  552. }
  553. }
  554. </style>