details.vue 16 KB

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