seek_btob_details.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <div class="orderbtob_details_wrapper">
  3. <div class="mobile-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p v-if="active === 'done'">已报价</p>
  6. <p v-if="active === 'invalid'">已失效</p>
  7. <p v-if="active === 'agreed'">已采纳</p>
  8. <p v-if="active === 'todo'">我要报价</p>
  9. </div>
  10. <div class="orderbtob_details_content">
  11. <div class="orderbtob_details_top">
  12. <div class="item">
  13. <span class="name">客户:</span>
  14. {{listInfo.inquiry.enterprise && listInfo.inquiry.enterprise.enName}}
  15. </div>
  16. <div class="item clearfix">
  17. <span class="name fl">收货地址:</span>
  18. <span class="fl" style="width: 5.2rem">{{listInfo.inquiry.ship}}</span>
  19. </div>
  20. <div class="item clearfix">
  21. <span class="name fl">联系电话:</span>
  22. <span class="fl" style="width: 5.2rem">{{listInfo.inquiry.enterprise && listInfo.inquiry.enterprise.enTel}}</span>
  23. </div>
  24. <div class="item">
  25. <span class="name">单据:</span>
  26. {{listInfo.inquiry.code}}
  27. </div>
  28. <div class="item clearfix">
  29. <span class="name fl">物料:</span>
  30. <span class="fl" style="width: 5.2rem">
  31. <p>{{listInfo.product.code}}</p>
  32. <p style="margin:5px 0">{{listInfo.product.title}}</p>
  33. <p>{{listInfo.product.spec}}</p>
  34. </span>
  35. </div>
  36. <div class="item">
  37. <span class="name">币别:</span>
  38. {{listInfo.currency}}
  39. </div>
  40. <div class="item">
  41. <span class="name">税率:</span>
  42. {{listInfo.taxrate + '%' || '无'}}
  43. </div>
  44. <div class="item">
  45. <span class="name">询价类型:</span>
  46. {{listInfo.inquiry.inquirytype || '无'}}
  47. </div>
  48. <!--<div class="item">-->
  49. <!--<span class="name">金额:</span>-->
  50. <!--{{listInfo.sum}}-->
  51. <!--</div>-->
  52. </div>
  53. <div class="orderbtob_details_middle">
  54. <div class="list">
  55. <template v-if="active === 'todo'">
  56. <div class="item clearfix">
  57. <span class="name">交货周期:</span>
  58. <input type="number" class="dateinput" v-model="listInfo.leadtime" >天
  59. </div>
  60. <div class="item clearfix">
  61. <span class="name">最小起订:</span>
  62. <input type="number" class="dateinput" v-model="listInfo.minOrderQty" >PCS
  63. </div>
  64. <div class="item clearfix">
  65. <span class="name">最小包装:</span>
  66. <input type="number" class="dateinput" v-model="listInfo.minPackQty">PCS
  67. </div>
  68. </template>
  69. <template v-else>
  70. <div class="item clearfix">
  71. <span class="name">交货周期:</span>
  72. <span>{{listInfo.leadtime || '-'}}天</span>
  73. </div>
  74. <div class="item clearfix">
  75. <span class="name">最小起订:</span>
  76. <span>{{listInfo.minOrderQty || '-'}}PCS</span>
  77. </div>
  78. <div class="item clearfix">
  79. <span class="name">最小包装:</span>
  80. <span>{{listInfo.minPackQty || '-'}}PCS</span>
  81. </div>
  82. </template>
  83. <div class="item clearfix" style="position: relative">
  84. <span class="fl name">分段报价:</span>
  85. <ul class="fl table">
  86. <li class="li_title clearfix">
  87. <div class="fl fisrt">段数</div>
  88. <div class="fl">分段数量</div>
  89. <div class="fl" >分段单价</div>
  90. </li>
  91. <li class="li_content clearfix" v-for="(item, index) in listInfo.replies">
  92. <div class="fl fisrt">{{index + 1}}</div>
  93. <div class="fl" v-if="index === 0">
  94. <input type="number" value="0" disabled readonly />
  95. </div>
  96. <div class="fl" v-if="index !== 0">
  97. <input type="number" v-model="item.lapQty" />
  98. </div>
  99. <div class="fl" >
  100. <input type="number" v-model="item.price" :readonly="active !== 'todo'"/>
  101. </div>
  102. </li>
  103. <div class="posixicon" v-if="active === 'todo'">
  104. <i class="iconfont icon-add" @click="addItem()"></i>
  105. <i class="iconfont icon-minus" @click="deleteItem()"></i>
  106. </div>
  107. </ul>
  108. <div style="clear:both"></div>
  109. <div class="replayBtn" @click="Replay(item)" v-if="active === 'todo'">
  110. 报价
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  117. </div>
  118. </template>
  119. <script>
  120. import { RemindBox } from '~components/mobile/common'
  121. export default {
  122. name: 'seek_btob_details',
  123. layout: 'mobileActivity',
  124. middleware: 'authenticated',
  125. data() {
  126. return {
  127. active: this.$route.query.active,
  128. listInfo: {
  129. inquiry: { },
  130. replies: [{
  131. lapQty: 0,
  132. price: ''
  133. }],
  134. product: {}
  135. },
  136. token: '',
  137. collectResult: '',
  138. timeoutCount: 0
  139. }
  140. },
  141. created() {
  142. this.getInitInfo()
  143. this._getToken()
  144. },
  145. methods: {
  146. addItem() {
  147. this.listInfo.replies.push({
  148. lapQty: '',
  149. price: ''
  150. })
  151. },
  152. deleteItem() {
  153. if (this.listInfo.replies.length === 1) {
  154. return
  155. }
  156. this.listInfo.replies.splice(this.listInfo.replies.length - 1, 1)
  157. },
  158. Replay() {
  159. if (this.listInfo.leadtime === '') {
  160. this._iniFo('交货周期不能为空')
  161. return
  162. } else if (this.listInfo.minOrderQty === '') {
  163. this._iniFo('最小起订量不能为空')
  164. return
  165. } else if (this.listInfo.minPackQty === '') {
  166. this._iniFo('最小包装不能为空')
  167. return
  168. }
  169. let replies = []
  170. // 判断分段数是否合法
  171. let valid = true
  172. let validLapQty = 0
  173. let _listInfo = this.listInfo
  174. this.listInfo.replies.forEach(function (r, i) {
  175. if ((i > 0 ? r.lapQty : 1) || r.price) {
  176. replies.push(r)
  177. }
  178. // 直接比较是字符串比较,需要先转换再比较 2017年9月7日 15:05:51
  179. if (i > 0 && parseInt(r.lapQty) <= parseInt(_listInfo.replies[i - 1].lapQty) || r.lapQty == null) {
  180. valid = false
  181. validLapQty = r.lapQty
  182. }
  183. })
  184. if (!valid) {
  185. if (validLapQty) {
  186. this._iniFo('分段' + validLapQty + '小于等于了上一分段数,不能保存!')
  187. } else {
  188. this._iniFo('分段数量不合法,不能保存!')
  189. }
  190. return
  191. }
  192. this.listInfo.replies = replies
  193. this.$http.post(`/sale/inquiry/items/${this.$route.query.id}/reply?token=${this.token}`, this.listInfo).then(res => {
  194. this._iniFo('报价成功')
  195. // this.getInitInfo()
  196. let _this = this
  197. setTimeout(function () {
  198. // _this.$router.push(`/mobile/center/vendor/seek_btob_details?id=${this.$route.query.id}&active=done`)
  199. _this.$router.go(-1)
  200. }, 500)
  201. })
  202. },
  203. _iniFo(str) {
  204. this.collectResult = str
  205. this.timeoutCount++
  206. },
  207. getInitInfo() {
  208. this.$http.get(`/sale/inquiry/${this.$route.query.id}/info/mobile`).then(res => {
  209. if (!res.data.replies[0].price || res.data.replies[0].price === '') {
  210. res.data.replies[0].price = ''
  211. }
  212. this.listInfo = res.data
  213. })
  214. },
  215. _getToken() {
  216. this.$http.get('/token?userType=sale').then(res => {
  217. this.token = res.data.token
  218. })
  219. }
  220. },
  221. components: {
  222. RemindBox
  223. },
  224. filters: {
  225. time: function(time) {
  226. if (typeof time === 'number') {
  227. if (!time) {
  228. return '无'
  229. } else {
  230. let d = new Date(time)
  231. let year = d.getFullYear()
  232. let month = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : '' + (d.getMonth() + 1)
  233. let day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  234. return year + '-' + month + '-' + day
  235. }
  236. }
  237. }
  238. }
  239. }
  240. </script>
  241. <style scoped lang="scss">
  242. .orderbtob_details_wrapper {
  243. background: #f5f5f5;
  244. position: absolute;
  245. height: 100%;
  246. width: 100%;
  247. overflow-y: scroll;
  248. .mobile-header{
  249. position: fixed;
  250. top: 0;
  251. z-index: 10;
  252. width:100%;
  253. height:.88rem;
  254. line-height: .88rem;
  255. /*border-bottom:.01rem solid #ccc;*/
  256. background: #3e82f5;
  257. padding:0 .2rem 0 .1rem;
  258. color:#fff;
  259. }
  260. .mobile-header p{
  261. overflow: hidden;
  262. text-overflow: ellipsis;
  263. white-space: nowrap;
  264. font-size:.36rem;
  265. text-align: center;
  266. margin: 0;
  267. width: 6rem;
  268. padding-left: 1rem;
  269. }
  270. .mobile-header a{
  271. font-size:.28rem;
  272. color:#fff;
  273. position: absolute;
  274. }
  275. .mobile-header a i{
  276. font-size: .48rem;
  277. margin-right: -.1rem;
  278. }
  279. .orderbtob_details_content {
  280. margin-top: 0.9rem;
  281. padding: 0.2rem;
  282. .orderbtob_details_top {
  283. background: #3f84f6;
  284. border-radius: 0.07rem;
  285. border: solid 0.01rem #e3e5e8;
  286. padding: 0.24rem 0.2rem 0.14rem;
  287. .item {
  288. color: #fff;
  289. font-size: 0.28rem;
  290. margin-bottom: 0.1rem;
  291. }
  292. }
  293. .orderbtob_details_middle {
  294. margin-top: 0.2rem;
  295. .list {
  296. border: solid 1px #e3e5e8;
  297. border-radius: 0.07rem;
  298. overflow: hidden;
  299. color: #333;
  300. font-size: 0.28rem;
  301. padding: 0.24rem 0.2rem;
  302. margin-bottom: 0.2rem;
  303. background: #fff;
  304. .item {
  305. margin-bottom: 0.1rem;
  306. line-height: 0.5rem;
  307. }
  308. .ovrflow {
  309. width: 5.2rem;
  310. line-height: 0.5rem
  311. }
  312. .name {
  313. color: #666;
  314. width: 1.6rem;
  315. display: inline-block;
  316. }
  317. .dateinput {
  318. width: 3.49rem;
  319. height: .5rem;
  320. line-height: .5rem;
  321. border: 1px solid #aeaeae;
  322. font-size: .26rem;
  323. vertical-align: middle;
  324. background: #fff;
  325. border-radius: 0;
  326. margin-right: 0.05rem;
  327. }
  328. }
  329. .replayBtn {
  330. width: 6.59rem;
  331. height: 0.77rem;
  332. background-color: #3f84f6;
  333. border-radius: 0.08rem;
  334. font-size: 0.28rem;
  335. line-height: 0.77rem;
  336. color: #ffffff;
  337. overflow: hidden;
  338. text-align: center;
  339. margin-top: 0.2rem
  340. }
  341. .table {
  342. width: 4.52rem;
  343. background-color: #f3f3f3;
  344. color: #333333;
  345. font-size: 0.28rem;
  346. .li_title {
  347. border: 1px solid #c5c5c5;
  348. div {
  349. width: 1.87rem;
  350. text-align: center;
  351. border-right: 1px solid #c5c5c5;
  352. &:last-child {
  353. border-right: 0
  354. }
  355. }
  356. .fisrt {
  357. width: 0.74rem;
  358. }
  359. }
  360. .li_content {
  361. border: 1px solid #c5c5c5;
  362. background: #fff;
  363. border-top: 0px;
  364. div {
  365. width: 1.87rem;
  366. text-align: center;
  367. border-right: 1px solid #c5c5c5;
  368. &:last-child {
  369. border-right: 0
  370. }
  371. input {
  372. text-align: center;
  373. width: 100%;
  374. height: 0.49rem;
  375. border: 0;
  376. }
  377. }
  378. .fisrt {
  379. width: 0.74rem;
  380. }
  381. }
  382. }
  383. }
  384. .bottom {
  385. font-size: 0.2rem;
  386. color: #999;
  387. border-top: 1px solid #aeaeae;
  388. padding-top: 0.1rem;
  389. }
  390. .noborder{
  391. border: 0
  392. }
  393. }
  394. .icon-add {
  395. color: #00d300;
  396. font-size: 0.4rem
  397. }
  398. .icon-minus {
  399. color: #cacaca;
  400. font-size: 0.4rem;
  401. display: block;
  402. }
  403. .posixicon {
  404. position: absolute;
  405. right: 0.3rem;
  406. width: 0.4rem;
  407. top: 0;
  408. }
  409. }
  410. </style>