seek_btob_details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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.enterprise && listInfo.inquiry.enterprise.enAddress}}</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" v-if="listInfo.replies && listInfo.replies.length > 0">
  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.length === 0 || !res.data.replies[0].price) {
  210. res.data.replies[0] = res.data.replies[0] || {}
  211. res.data.replies[0].price = ''
  212. }
  213. this.listInfo = res.data
  214. })
  215. },
  216. _getToken() {
  217. this.$http.get('/token?userType=sale').then(res => {
  218. this.token = res.data.token
  219. })
  220. }
  221. },
  222. components: {
  223. RemindBox
  224. },
  225. filters: {
  226. time: function(time) {
  227. if (typeof time === 'number') {
  228. if (!time) {
  229. return '无'
  230. } else {
  231. let d = new Date(time)
  232. let year = d.getFullYear()
  233. let month = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : '' + (d.getMonth() + 1)
  234. let day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  235. return year + '-' + month + '-' + day
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </script>
  242. <style scoped lang="scss">
  243. .orderbtob_details_wrapper {
  244. background: #f5f5f5;
  245. position: absolute;
  246. height: 100%;
  247. width: 100%;
  248. overflow-y: scroll;
  249. .mobile-header{
  250. position: fixed;
  251. top: 0;
  252. z-index: 10;
  253. width:100%;
  254. height:.88rem;
  255. line-height: .88rem;
  256. /*border-bottom:.01rem solid #ccc;*/
  257. background: #3e82f5;
  258. padding:0 .2rem 0 .1rem;
  259. color:#fff;
  260. }
  261. .mobile-header p{
  262. overflow: hidden;
  263. text-overflow: ellipsis;
  264. white-space: nowrap;
  265. font-size:.36rem;
  266. text-align: center;
  267. margin: 0;
  268. width: 6rem;
  269. padding-left: 1rem;
  270. }
  271. .mobile-header a{
  272. font-size:.28rem;
  273. color:#fff;
  274. position: absolute;
  275. }
  276. .mobile-header a i{
  277. font-size: .48rem;
  278. margin-right: -.1rem;
  279. }
  280. .orderbtob_details_content {
  281. margin-top: 0.9rem;
  282. padding: 0.2rem;
  283. .orderbtob_details_top {
  284. background: #3f84f6;
  285. border-radius: 0.07rem;
  286. border: solid 0.01rem #e3e5e8;
  287. padding: 0.24rem 0.2rem 0.14rem;
  288. .item {
  289. color: #fff;
  290. font-size: 0.28rem;
  291. margin-bottom: 0.1rem;
  292. }
  293. }
  294. .orderbtob_details_middle {
  295. margin-top: 0.2rem;
  296. .list {
  297. border: solid 1px #e3e5e8;
  298. border-radius: 0.07rem;
  299. overflow: hidden;
  300. color: #333;
  301. font-size: 0.28rem;
  302. padding: 0.24rem 0.2rem;
  303. margin-bottom: 0.2rem;
  304. background: #fff;
  305. .item {
  306. margin-bottom: 0.1rem;
  307. line-height: 0.5rem;
  308. }
  309. .ovrflow {
  310. width: 5.2rem;
  311. line-height: 0.5rem
  312. }
  313. .name {
  314. color: #666;
  315. width: 1.6rem;
  316. display: inline-block;
  317. }
  318. .dateinput {
  319. width: 3.49rem;
  320. height: .5rem;
  321. line-height: .5rem;
  322. border: 1px solid #aeaeae;
  323. font-size: .26rem;
  324. vertical-align: middle;
  325. background: #fff;
  326. border-radius: 0;
  327. margin-right: 0.05rem;
  328. }
  329. }
  330. .replayBtn {
  331. width: 6.59rem;
  332. height: 0.77rem;
  333. background-color: #3f84f6;
  334. border-radius: 0.08rem;
  335. font-size: 0.28rem;
  336. line-height: 0.77rem;
  337. color: #ffffff;
  338. overflow: hidden;
  339. text-align: center;
  340. margin-top: 0.2rem
  341. }
  342. .table {
  343. width: 4.52rem;
  344. background-color: #f3f3f3;
  345. color: #333333;
  346. font-size: 0.28rem;
  347. .li_title {
  348. border: 1px solid #c5c5c5;
  349. div {
  350. width: 1.87rem;
  351. text-align: center;
  352. border-right: 1px solid #c5c5c5;
  353. &:last-child {
  354. border-right: 0
  355. }
  356. }
  357. .fisrt {
  358. width: 0.74rem;
  359. }
  360. }
  361. .li_content {
  362. border: 1px solid #c5c5c5;
  363. background: #fff;
  364. border-top: 0px;
  365. div {
  366. width: 1.87rem;
  367. text-align: center;
  368. border-right: 1px solid #c5c5c5;
  369. &:last-child {
  370. border-right: 0
  371. }
  372. input {
  373. text-align: center;
  374. width: 100%;
  375. height: 0.49rem;
  376. border: 0;
  377. }
  378. }
  379. .fisrt {
  380. width: 0.74rem;
  381. }
  382. }
  383. }
  384. }
  385. .bottom {
  386. font-size: 0.2rem;
  387. color: #999;
  388. border-top: 1px solid #aeaeae;
  389. padding-top: 0.1rem;
  390. }
  391. .noborder{
  392. border: 0
  393. }
  394. }
  395. .icon-add {
  396. color: #00d300;
  397. font-size: 0.4rem
  398. }
  399. .icon-minus {
  400. color: #cacaca;
  401. font-size: 0.4rem;
  402. display: block;
  403. }
  404. .posixicon {
  405. position: absolute;
  406. right: 0.3rem;
  407. width: 0.4rem;
  408. top: 0;
  409. }
  410. }
  411. </style>