SayPriceInfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="mobile-modal" @touchmove="preventTouchMove($event)">
  3. <div class="mobile-modal-box" ref="modalBody">
  4. <div class="mobile-modal-header">{{purchaseDetail.agreed == 1 || agreed == 1 ? '已采纳' : '已报价'}}<i class="icon-guanbi iconfont" @click="cancel"></i></div>
  5. <div class="say-price-info" ref="mobileModalBox">
  6. <div>
  7. <div v-if="isBuyer">
  8. <!-- <div class="base-info">
  9. <div class="content-line">
  10. 品牌:<span>{{purchaseDetail.inbrand || '-'}}</span>
  11. </div>
  12. <div class="content-line">
  13. 类目(产品名称):<span>{{purchaseDetail.prodTitle || '-'}}</span>
  14. </div>
  15. <div class="content-line">
  16. 型号:<span>{{purchaseDetail.cmpCode || '-'}}</span>
  17. </div>
  18. <div class="content-line">
  19. 规格:<span>{{purchaseDetail.spec || '-'}}</span>
  20. </div>
  21. <div class="content-line">
  22. 采购数量(PCS):<span>{{purchaseDetail.needquantity || '-'}}</span>
  23. </div>
  24. &lt;!&ndash;<div class="content-line">
  25. 币种:<span>{{purchaseDetail.custCurrency || '不限'}}</span>
  26. </div>
  27. <div class="content-line">
  28. 生产日期:<span>{{purchaseDetail.produceDate || '-'}}</span>
  29. </div>&ndash;&gt;
  30. <div class="content-line">
  31. 截止日期:<span>{{purchaseDetail.endDate | date}}</span>
  32. </div>
  33. </div>
  34. <div class="base-info">
  35. <div class="content-line">
  36. 买家:<span>{{purchaseDetail.inquiry && purchaseDetail.inquiry.enterprise ? purchaseDetail.inquiry.enterprise.enName : purchaseDetail.userName}}</span>
  37. </div>
  38. <div class="content-line">
  39. 联系电话:<span>{{purchaseDetail.userTel || '-'}}</span>
  40. </div>
  41. </div>-->
  42. <div class="base-info say-info" v-for="(item, index) in purchaseDetail.qutations" @click="selectQutation(index)">
  43. <img v-if="agreed != 1 && (!item.agreed || item.agreed !== 1) && activeIndex == index" src="/images/mobile/@2x/applyPurchase/say-price-check.png" alt="">
  44. <img v-if="agreed != 1 && (!item.agreed || item.agreed !== 1) && activeIndex != index" src="/images/mobile/@2x/applyPurchase/say-price-default.png" alt="">
  45. <img v-if="item.agreed == 1" src="/images/mobile/@2x/applyPurchase/say-price-accept.png" alt="">
  46. <div class="content-line">
  47. {{item.vendName}}
  48. </div>
  49. <div class="content-line">
  50. 报价人:<span v-if="item.user">{{item.user.userName}}</span>
  51. <span v-else>-</span>
  52. </div>
  53. <div class="content-line">
  54. 电话:<span v-if="item.user">{{item.user.userTel}}</span>
  55. <span v-else>-</span>
  56. </div>
  57. <div class="content-line date">
  58. 交期(天):<span>{{item.leadtime}}</span>
  59. </div>
  60. <p>{{item.offerTime | date}}</p>
  61. <div class="price-level">
  62. <p>价格梯度:<span>(pcs)</span></p>
  63. <ul>
  64. <li v-for="replie in item.replies">
  65. <span>{{replie.lapQty ? replie.lapQty + '+' : '-'}}</span>
  66. <span>{{replie.price ? (item.currency == 'USD' ? '$' : '¥') + replie.price : '-'}}</span>
  67. </li>
  68. </ul>
  69. </div>
  70. </div>
  71. <a class="say-price-btn" v-if="purchaseDetail.agreed != 1" @click="acceptQutation">采纳报价</a>
  72. <div style="height: 0.5rem;width: 100%"></div>
  73. </div>
  74. <div v-if="!isBuyer">
  75. <div class="base-info">
  76. <!--<div class="content-line">
  77. 品牌:<span>{{purchaseDetail.inbrand || '-'}}</span>
  78. </div>
  79. <div class="content-line">
  80. 类目(产品名称):<span>{{purchaseDetail.prodTitle || '-'}}</span>
  81. </div>
  82. <div class="content-line">
  83. 型号:<span>{{purchaseDetail.cmpCode || '-'}}</span>
  84. </div>
  85. <div class="content-line">
  86. 规格:<span>{{purchaseDetail.spec || '-'}}</span>
  87. </div>
  88. <div class="content-line">
  89. 采购数量(PCS):<span>{{purchaseDetail.needquantity || '-'}}</span>
  90. </div>-->
  91. <!--<div class="content-line">
  92. 币种:<span>{{purchaseDetail.custCurrency || '不限'}}</span>
  93. </div>
  94. <div class="content-line">
  95. 生产日期:<span>{{purchaseDetail.produceDate || '-'}}</span>
  96. </div>-->
  97. <!-- <div class="content-line">
  98. 截止日期:<span>{{purchaseDetail.endDate | date}}</span>
  99. </div>-->
  100. <div class="content-line">
  101. 买家:<span>{{purchaseDetail.inquiry && purchaseDetail.inquiry.enterprise ? purchaseDetail.inquiry.enterprise.enName : purchaseDetail.userName}}</span>
  102. </div>
  103. <div class="content-line">
  104. 联系电话:<span>{{purchaseDetail.userTel || '-'}}</span>
  105. </div>
  106. </div>
  107. <div class="base-info">
  108. <div class="content-line">
  109. 报价人:<span v-if="purchaseDetail.user">{{purchaseDetail.user.userName}}</span>
  110. <span v-else>-</span>
  111. </div>
  112. <div class="content-line">
  113. 联系电话:<span v-if="purchaseDetail.user">{{purchaseDetail.user.userTel || '-'}}</span>
  114. <span v-else>-</span>
  115. </div>
  116. </div>
  117. <div class="base-info say-info">
  118. <div class="content-line date">
  119. 交期(天):<span>{{purchaseDetail.leadtime}}</span>
  120. </div>
  121. <p>{{purchaseDetail.offerTime | date}}</p>
  122. <div class="price-level vendor">
  123. <p>价格梯度:<span>(pcs)</span></p>
  124. <ul>
  125. <li v-for="replie in purchaseDetail.replies">
  126. <span>{{replie.lapQty ? replie.lapQty + '+' : '-'}}</span>
  127. <span>{{replie.price ? (purchaseDetail.currency == 'USD' ? '$' : '¥') + replie.price : '-'}}</span>
  128. </li>
  129. </ul>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  135. </div>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import {RemindBox} from '~components/mobile/common'
  141. export default {
  142. data () {
  143. return {
  144. activeIndex: -1,
  145. remindText: '',
  146. timeoutCount: 0
  147. }
  148. },
  149. components: {
  150. RemindBox
  151. },
  152. props: ['agreed', 'userType'],
  153. filters: {
  154. date: function (date) {
  155. if (date) {
  156. const d = new Date(Number(date))
  157. const year = d.getFullYear()
  158. const monthTemp = d.getMonth() + 1
  159. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  160. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  161. return year + '-' + month + '-' + day
  162. } else {
  163. return '-'
  164. }
  165. },
  166. userNameFilter (str) {
  167. return str ? str.substring(0, 1) + '**' : '-'
  168. }
  169. },
  170. computed: {
  171. purchaseDetail () {
  172. return this.isBuyer ? this.$store.state.applyPurchase.purchaseManList.buyerInquiryDetail.data : this.$store.state.applyPurchase.purchaseManList.vendorInquiryDetail.data
  173. },
  174. user () {
  175. return this.$store.state.option.user
  176. },
  177. isBuyer () {
  178. return this.$route.query.type === 'buyer' || this.userType === 'buyer'
  179. }
  180. },
  181. methods: {
  182. cancel: function () {
  183. this.$emit('cancelSayPriceInfoAction', false)
  184. },
  185. selectQutation: function (index) {
  186. this.activeIndex = this.activeIndex === index ? -1 : index
  187. },
  188. acceptQutation: function () {
  189. if (this.activeIndex > -1) {
  190. let obj = this.purchaseDetail.qutations[this.activeIndex]
  191. this.$http.post('/inquiry/buyer/decide?id=' + obj.id + '&status=1')
  192. .then(response => {
  193. // this.$message.success('采纳成功')
  194. // this.onRemind('采纳成功')
  195. this.$emit('cancelSayPriceInfoAction', true)
  196. // this.$route.query.type === 'saler' ? this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {id: this.$route.params.id}) : this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {id: this.$route.params.id})
  197. }, err => {
  198. console.log(err)
  199. // this.$message.success('系统错误')
  200. this.onRemind('系统错误')
  201. })
  202. } else {
  203. // this.$message.success('请选择报价信息')
  204. this.onRemind('请选择报价信息')
  205. }
  206. },
  207. onRemind: function (str) {
  208. this.remindText = str
  209. this.timeoutCount ++
  210. }
  211. },
  212. mounted() {
  213. this.$nextTick(() => {
  214. this._initscroll()
  215. // console.log(this.$refs.modalBody.scrollHeight)
  216. this.$refs.modalBody.style.marginTop = (0 - (this.$refs.modalBody.scrollHeight / 2)) / 100 - 2.5 + 'rem'
  217. })
  218. }
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. .mobile-modal {
  223. .mobile-modal-box {
  224. top: 50%;
  225. left: 3%;
  226. right: 3%;
  227. width: 7rem;
  228. margin: 0 auto;
  229. .say-price-info {
  230. background: #f3f3f3;
  231. padding: 0px;
  232. width: 100%;
  233. overflow: hidden;
  234. max-height: 90%;
  235. .base-info {
  236. &:last-child {
  237. margin-bottom: 0;
  238. }
  239. &.say-info {
  240. /*height: 4.54rem;*/
  241. position: relative;
  242. margin-top: .18rem;
  243. > img {
  244. position: absolute;
  245. right: 0;
  246. top: 0;
  247. width: 1rem;
  248. height: 1rem;
  249. }
  250. .content-line {
  251. width: 4.55rem;
  252. span {
  253. color: #333;
  254. }
  255. &.date {
  256. span {
  257. color: #ef5042;
  258. }
  259. }
  260. }
  261. > p {
  262. font-size: .24rem;
  263. color: #999;
  264. }
  265. .price-level {
  266. font-size: .26rem;
  267. /*position: absolute;*/
  268. /*top: 1.3rem;*/
  269. /*right: .3rem;*/
  270. position: relative;
  271. bottom: .3rem;
  272. width: 4.4rem;
  273. text-align: center;
  274. margin-left: 2rem;
  275. p {
  276. margin-bottom: .1rem;
  277. span {
  278. color: #666;
  279. }
  280. }
  281. ul {
  282. li {
  283. height: .52rem;
  284. span {
  285. height: .52rem;
  286. line-height: .52rem;
  287. padding-left: .22rem;
  288. text-align: left;
  289. display: inline-block;
  290. border-top: .02rem solid #7e7e7e;
  291. border-left: .02rem solid #7e7e7e;
  292. overflow: hidden;
  293. text-overflow: ellipsis;
  294. white-space: nowrap;
  295. width: 50%;
  296. &:last-child {
  297. border-right: .02rem solid #7e7e7e;
  298. }
  299. }
  300. &:last-child {
  301. border-bottom: .02rem solid #7e7e7e;
  302. }
  303. }
  304. }
  305. &.vendor {
  306. margin: .15rem auto 0;
  307. }
  308. }
  309. }
  310. }
  311. .say-price-btn {
  312. margin: .37rem auto 0rem;
  313. }
  314. }
  315. }
  316. }
  317. </style>