seek_btob_details.vue 12 KB

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