detail_buy.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. <template>
  2. <view class="container">
  3. <view class="introduce-section">
  4. <view class="price-box">
  5. <view class="title">{{goods.title}}</view>
  6. <view v-if='goods.isFutures==0' class="title-tip">
  7. <text class="price-tip">¥</text>
  8. <text class="price">{{goods.price}}</text>
  9. <text class="price-tip">元/吨</text>
  10. </view>
  11. <view v-else class="title-tip">
  12. <text class="price-tip">今日基差</text>
  13. <text class="price-tip">¥</text>
  14. <text class="price-tip">{{goods.basis}}</text>
  15. <text class="price-tip">元/吨</text>
  16. </view>
  17. </view>
  18. <view class="bot-row">
  19. <view v-if='goods.companyId==2' class='cu-tag radius line-orange'>佳屹农</view>
  20. <view v-else class='cu-tag radius line-orange'>易粮易运</view>
  21. <view v-if='goods.buyerPhone && goods.companyId!=2' class='cu-tag radius line-orange' >{{goods.buyerPhone}}</view>
  22. </view>
  23. <view class="bot-row">
  24. <view v-if='goods.companyId!=2' class='cu-tag radius line-orange'>剩余量: {{goods.total - goods.boughtCount}}吨</view>
  25. <view v-if='goods.companyId!=2' class='cu-tag radius line-orange'>总量: {{goods.total}}吨</view>
  26. </view>
  27. </view>
  28. <view class="detail-desc">
  29. <view class="d-header">
  30. <text>基本信息</text>
  31. </view>
  32. <view class="c-list">
  33. <view class="c-row b-b">
  34. <text class="tit">品种</text>
  35. <view class="con-list">
  36. <text>{{goods.goodsName}}</text>
  37. </view>
  38. </view>
  39. <view v-if='goods.companyId!=2' class="c-row b-b">
  40. <text class="tit">产地</text>
  41. <view class="con-list">
  42. <text>{{goods.origin}}</text>
  43. </view>
  44. </view>
  45. <view v-if='goods.companyId!=2' class="c-row b-b">
  46. <text class="tit">国标等级</text>
  47. <view class="con-list">
  48. <text>{{goods.level}}</text>
  49. </view>
  50. </view>
  51. <view v-if='goods.companyId!=2' class="c-row b-b">
  52. <text class="tit">年份</text>
  53. <view class="con-list">
  54. <text>{{goods.year}}</text>
  55. </view>
  56. </view>
  57. <view v-if='goods.companyId!=2' class="c-row b-b">
  58. <text class="tit">包装方式</text>
  59. <view class="con-list">
  60. <text>{{goods.packing}}</text>
  61. </view>
  62. </view>
  63. <view v-if='goods.companyId!=2' class="c-row b-b">
  64. <text class="tit">最小成交量</text>
  65. <view class="con-list">
  66. <text>{{goods.minSale}}(吨)</text>
  67. </view>
  68. </view>
  69. <view v-if='goods.isFutures==0' class="c-row b-b">
  70. <text class="tit">剩余量</text>
  71. <view class="con-list">
  72. <text>{{goods.total-goods.boughtCount}}</text>
  73. </view>
  74. </view>
  75. <!-- <view class="c-row b-b">
  76. <text class="tit">短溢装(%)</text>
  77. <view class="con-list">
  78. <text>{{goods.overFlow}}</text>
  79. </view>
  80. </view> -->
  81. <view class="c-row b-b">
  82. <text class="tit">价格类型</text>
  83. <view class="con-list">
  84. <text>{{goods.priceType}}</text>
  85. </view>
  86. </view>
  87. <view class="c-row b-b">
  88. <text class="tit">交货地</text>
  89. <view class="con-list">
  90. <text>{{goods.stock}}</text>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="d-header">
  95. <text>粮食指标</text>
  96. </view>
  97. <view class="c-list">
  98. <view v-if='goods.goodsName=="玉米"' class="c-row b-b">
  99. <text class="tit">杂质(%){{'<='}}</text>
  100. <view class="con-list">
  101. <text>{{goods.impurity}}</text>
  102. </view>
  103. </view>
  104. <view v-if='goods.goodsName=="玉米"' class="c-row b-b">
  105. <text class="tit">生霉粒(%){{'<='}}</text>
  106. <view class="con-list">
  107. <text>{{goods.moldy}}</text>
  108. </view>
  109. </view>
  110. <view v-if='goods.goodsName=="玉米"' class="c-row b-b">
  111. <text class="tit">容重(g/L){{'<='}}</text>
  112. <view class="con-list">
  113. <text>{{goods.bulkDensity}}</text>
  114. </view>
  115. </view>
  116. <view v-if='goods.goodsName=="玉米"' class="c-row b-b">
  117. <text class="tit">气味、色泽</text>
  118. <view class="con-list">
  119. <text>{{goods.smell}}</text>
  120. </view>
  121. </view>
  122. <!-- <view v-if='goods.goodsName=="玉米"' class="c-row b-b">
  123. <text class="tit">热损(%){{'<='}}</text>
  124. <view class="con-list">
  125. <text>{{goods.heatLoss}}</text>
  126. </view>
  127. </view> -->
  128. <view class="c-row b-b">
  129. <text class="tit">水分(%){{'<='}} </text>
  130. <view class="con-list">
  131. <text>{{goods.waterContent}}</text>
  132. </view>
  133. </view>
  134. <view v-if='goods.goodsName=="大豆"' class="c-row b-b">
  135. <text class="tit">蛋白(%){{'>='}} </text>
  136. <view class="con-list">
  137. <text>{{goods.protein}}</text>
  138. </view>
  139. </view>
  140. <view v-if='goods.goodsName=="大豆"' class="c-row b-b">
  141. <text class="tit">粒型</text>
  142. <view class="con-list">
  143. <text>{{goods.grainType}}</text>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <!-- 底部操作菜单 -->
  149. <view class="page-bottom">
  150. <view class="action-btn-group">
  151. <button type="primary" class=" action-btn no-border buy-now-btn" @click="contactUs">联系我们</button>
  152. <button v-if="goods.status == 20" type="primary" class=" action-btn no-border add-cart-btn" @click="tradeNow">我要卖粮</button>
  153. <button v-else type="primary" class=" action-btn no-border add-cart-btn" >交易结束</button>
  154. </view>
  155. </view>
  156. </view>
  157. </template>
  158. <script>
  159. import uniNumberBox from '@/components/uni-number-box.vue';
  160. import {
  161. mapState
  162. } from 'vuex';
  163. export default {
  164. components: {
  165. uniNumberBox
  166. },
  167. data() {
  168. return {
  169. goods: {
  170. },
  171. share:{
  172. title: '',
  173. imageUrl:'https://taohaoliang.oss-cn-beijing.aliyuncs.com/shareLogo.png',
  174. }
  175. };
  176. },
  177. onShow() {
  178. },
  179. onLoad(options) {
  180. const that = this
  181. uni.showLoading({
  182. title: '正在加载',
  183. mask:true
  184. })
  185. that.$api.request('goods', 'getBuyDetailInfo', {
  186. id: options.id
  187. }, failres => {
  188. that.$api.msg(failres.errmsg)
  189. uni.hideLoading()
  190. }).then(res => {
  191. that.goods = res.data
  192. // if(that.goods.soldCount >= that.goods.total){
  193. // that.goods.status = 0
  194. // }
  195. // that.share.title = that.goods.title
  196. uni.hideLoading()
  197. })
  198. },
  199. computed: {
  200. ...mapState(['hasLogin','userInfo'])
  201. },
  202. methods: {
  203. contactUs() {
  204. const that = this
  205. uni.makePhoneCall({
  206. // 手机号
  207. phoneNumber: that.goods.buyerPhone,
  208. // 成功回调
  209. success: (res) => {
  210. console.log('调用成功!')
  211. },
  212. // 失败回调
  213. fail: (res) => {
  214. console.log('调用失败!')
  215. }
  216. });
  217. },
  218. tradeNow(){
  219. if (!this.hasLogin) {
  220. uni.showModal({
  221. title: '登录提示',
  222. content: '您尚未登录,是否立即登录?',
  223. showCancel: true,
  224. confirmText: '登录',
  225. success: (e) => {
  226. if (e.confirm) {
  227. uni.navigateTo({
  228. url: '/pages/public/login'
  229. })
  230. }
  231. },
  232. fail: () => {},
  233. complete: () => {}
  234. })
  235. }
  236. else{
  237. const that = this
  238. uni.navigateTo({
  239. url: `/pageA/product/trade_buy?id=${that.goods.id}&packing=${that.goods.packing}&province=${that.goods.province}
  240. &city=${that.goods.city}&area=${that.goods.area}&storeName=${that.goods.storeName}&buyer=${that.goods.buyer}
  241. &companyId=${that.goods.companyId}&buyerPhone=${that.goods.buyerPhone}&minSale=${that.goods.minSale}
  242. &exsitCount=${that.goods.total}&isFutures=${that.goods.isFutures}&basis=${that.goods.basis}&unloadingFee=${that.goods.unloadingFee}`
  243. })
  244. }
  245. }
  246. },
  247. }
  248. </script>
  249. <style lang='scss'>
  250. page {
  251. background: $page-color-base;
  252. /* padding-bottom: 160upx; */
  253. }
  254. .container{
  255. padding-bottom: 160upx;
  256. }
  257. .icon-you {
  258. font-size: $font-base + 2upx;
  259. color: #888;
  260. }
  261. .carousel {
  262. height: 722upx;
  263. position: relative;
  264. swiper {
  265. height: 100%;
  266. }
  267. .image-wrapper {
  268. width: 100%;
  269. height: 100%;
  270. }
  271. .swiper-item {
  272. display: flex;
  273. justify-content: center;
  274. align-content: center;
  275. height: 750upx;
  276. overflow: hidden;
  277. image {
  278. width: 100%;
  279. height: 100%;
  280. }
  281. }
  282. }
  283. /* 标题简介 */
  284. .introduce-section {
  285. background: #fff;
  286. padding: 20upx 30upx;
  287. .title {
  288. font-size: 28upx;
  289. color: $font-color-dark;
  290. height: 50upx;
  291. line-height: 50upx;
  292. flex:3;
  293. }
  294. .title-tip {
  295. flex:2;
  296. }
  297. .price-box {
  298. display: flex;
  299. align-items: baseline;
  300. height: 120upx;
  301. padding: 10upx 0;
  302. font-size: 26upx;
  303. color: $uni-color-primary;
  304. }
  305. .price {
  306. font-size: $font-lg + 2upx;
  307. }
  308. .m-price {
  309. margin: 0 12upx;
  310. color: $font-color-light;
  311. text-decoration: line-through;
  312. }
  313. .coupon-tip {
  314. align-items: center;
  315. padding: 4upx 10upx;
  316. background: $uni-color-primary;
  317. font-size: $font-sm;
  318. color: #fff;
  319. border-radius: 6upx;
  320. line-height: 1;
  321. transform: translateY(-4upx);
  322. }
  323. .bot-row {
  324. display: flex;
  325. align-items: center;
  326. height: 50upx;
  327. font-size: $font-sm;
  328. color: $font-color-light;
  329. view {
  330. flex: 1;
  331. }
  332. }
  333. }
  334. .c-list {
  335. font-size: $font-sm + 2upx;
  336. color: $font-color-base;
  337. background: #fff;
  338. .c-row {
  339. display: flex;
  340. align-items: center;
  341. padding: 20upx 30upx;
  342. position: relative;
  343. }
  344. .tit {
  345. width: 180upx;
  346. }
  347. .con {
  348. flex: 1;
  349. color: $font-color-dark;
  350. .selected-text {
  351. margin-right: 10upx;
  352. }
  353. }
  354. .bz-list {
  355. height: 40upx;
  356. font-size: $font-sm+2upx;
  357. color: $font-color-dark;
  358. text {
  359. display: inline-block;
  360. margin-right: 30upx;
  361. }
  362. }
  363. .con-list {
  364. flex: 1;
  365. display: flex;
  366. flex-direction: column;
  367. color: $font-color-dark;
  368. line-height: 40upx;
  369. text-align: right;
  370. padding-right: 20upx;
  371. }
  372. .red {
  373. color: $uni-color-primary;
  374. }
  375. }
  376. /* 评价 */
  377. .eva-section {
  378. display: flex;
  379. flex-direction: column;
  380. padding: 20upx 30upx;
  381. background: #fff;
  382. margin-top: 16upx;
  383. .e-header {
  384. display: flex;
  385. align-items: center;
  386. height: 70upx;
  387. font-size: $font-sm + 2upx;
  388. color: $font-color-light;
  389. .tit {
  390. font-size: $font-base + 2upx;
  391. color: $font-color-dark;
  392. margin-right: 4upx;
  393. }
  394. .tip {
  395. flex: 1;
  396. text-align: right;
  397. }
  398. .icon-you {
  399. margin-left: 10upx;
  400. }
  401. }
  402. }
  403. .eva-box {
  404. display: flex;
  405. padding: 20upx 0;
  406. .portrait {
  407. flex-shrink: 0;
  408. width: 80upx;
  409. height: 80upx;
  410. border-radius: 100px;
  411. }
  412. .right {
  413. flex: 1;
  414. display: flex;
  415. flex-direction: column;
  416. font-size: $font-base;
  417. color: $font-color-base;
  418. padding-left: 26upx;
  419. .con {
  420. font-size: $font-base;
  421. color: $font-color-dark;
  422. padding: 20upx 0;
  423. }
  424. .bot {
  425. display: flex;
  426. justify-content: space-between;
  427. font-size: $font-sm;
  428. color: $font-color-light;
  429. }
  430. }
  431. }
  432. /* 详情 */
  433. .detail-desc {
  434. background: #fff;
  435. margin-top: 16upx;
  436. width: 750upx;
  437. .d-header {
  438. display: flex;
  439. justify-content: center;
  440. align-items: center;
  441. height: 80upx;
  442. font-size: $font-base + 2upx;
  443. color: $font-color-dark;
  444. position: relative;
  445. text {
  446. padding: 0 20upx;
  447. background: #fff;
  448. position: relative;
  449. z-index: 1;
  450. }
  451. &:after {
  452. position: absolute;
  453. left: 50%;
  454. top: 50%;
  455. transform: translateX(-50%);
  456. width: 300upx;
  457. height: 0;
  458. content: '';
  459. border-bottom: 1px solid #ccc;
  460. }
  461. }
  462. }
  463. /* 规格选择弹窗 */
  464. .attr-content {
  465. padding: 10upx 30upx;
  466. .a-t {
  467. display: flex;
  468. image {
  469. width: 170upx;
  470. height: 170upx;
  471. flex-shrink: 0;
  472. margin-top: -40upx;
  473. border-radius: 8upx;
  474. ;
  475. }
  476. .right {
  477. display: flex;
  478. flex-direction: column;
  479. padding-left: 24upx;
  480. font-size: $font-sm + 2upx;
  481. color: $font-color-base;
  482. line-height: 42upx;
  483. .price {
  484. font-size: $font-lg;
  485. color: $uni-color-primary;
  486. margin-bottom: 10upx;
  487. }
  488. .selected-text {
  489. margin-right: 10upx;
  490. }
  491. }
  492. }
  493. .attr-list {
  494. display: flex;
  495. flex-direction: column;
  496. font-size: $font-base + 2upx;
  497. color: $font-color-base;
  498. padding-top: 30upx;
  499. padding-left: 10upx;
  500. }
  501. .item-list {
  502. padding: 30upx 0 0;
  503. display: flex;
  504. flex-wrap: wrap;
  505. text {
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. background: #eee;
  510. margin-right: 20upx;
  511. margin-bottom: 20upx;
  512. border-radius: 100upx;
  513. min-width: 60upx;
  514. height: 60upx;
  515. padding: 0 20upx;
  516. font-size: $font-base;
  517. color: $font-color-dark;
  518. }
  519. .selected {
  520. background: #fbebee;
  521. color: $uni-color-primary;
  522. }
  523. }
  524. }
  525. /* 弹出层 */
  526. .popup {
  527. position: fixed;
  528. left: 0;
  529. top: 0;
  530. right: 0;
  531. bottom: 0;
  532. z-index: 99;
  533. &.show {
  534. display: block;
  535. .mask {
  536. animation: showPopup 0.2s linear both;
  537. }
  538. .layer {
  539. animation: showLayer 0.2s linear both;
  540. }
  541. }
  542. &.hide {
  543. .mask {
  544. animation: hidePopup 0.2s linear both;
  545. }
  546. .layer {
  547. animation: hideLayer 0.2s linear both;
  548. }
  549. }
  550. &.none {
  551. display: none;
  552. }
  553. .mask {
  554. position: fixed;
  555. top: 0;
  556. width: 100%;
  557. height: 100%;
  558. z-index: 1;
  559. background-color: rgba(0, 0, 0, 0.4);
  560. }
  561. .layer {
  562. position: fixed;
  563. z-index: 99;
  564. bottom: 0;
  565. width: 100%;
  566. min-height: 40vh;
  567. border-radius: 10upx 10upx 0 0;
  568. background-color: #fff;
  569. .btn {
  570. height: 66upx;
  571. line-height: 66upx;
  572. border-radius: 100upx;
  573. background: $uni-color-primary;
  574. font-size: $font-base + 2upx;
  575. color: #fff;
  576. margin: 30upx auto 20upx;
  577. }
  578. }
  579. @keyframes showPopup {
  580. 0% {
  581. opacity: 0;
  582. }
  583. 100% {
  584. opacity: 1;
  585. }
  586. }
  587. @keyframes hidePopup {
  588. 0% {
  589. opacity: 1;
  590. }
  591. 100% {
  592. opacity: 0;
  593. }
  594. }
  595. @keyframes showLayer {
  596. 0% {
  597. transform: translateY(120%);
  598. }
  599. 100% {
  600. transform: translateY(0%);
  601. }
  602. }
  603. @keyframes hideLayer {
  604. 0% {
  605. transform: translateY(0);
  606. }
  607. 100% {
  608. transform: translateY(120%);
  609. }
  610. }
  611. }
  612. /* 底部操作菜单 */
  613. .page-bottom {
  614. position: fixed;
  615. left: 30upx;
  616. bottom: 30upx;
  617. z-index: 95;
  618. display: flex;
  619. justify-content: center;
  620. align-items: center;
  621. width: 690upx;
  622. height: 100upx;
  623. background: rgba(255, 255, 255, .9);
  624. box-shadow: 0 0 20upx 0 rgba(0, 0, 0, .5);
  625. border-radius: 16upx;
  626. .p-b-btn {
  627. display: flex;
  628. flex-direction: column;
  629. align-items: center;
  630. justify-content: center;
  631. font-size: $font-sm;
  632. color: $font-color-base;
  633. width: 96upx;
  634. height: 80upx;
  635. .yticon {
  636. font-size: 40upx;
  637. line-height: 48upx;
  638. color: $font-color-light;
  639. }
  640. &.active,
  641. &.active .yticon {
  642. color: $uni-color-primary;
  643. }
  644. .icon-fenxiang2 {
  645. font-size: 42upx;
  646. transform: translateY(-2upx);
  647. }
  648. .icon-shoucang {
  649. font-size: 46upx;
  650. }
  651. }
  652. }
  653. /* 优惠券面板 */
  654. .mask {
  655. display: flex;
  656. align-items: flex-end;
  657. position: fixed;
  658. left: 0;
  659. top: var(--window-top);
  660. bottom: 0;
  661. width: 100%;
  662. background: rgba(0, 0, 0, 0);
  663. z-index: 9995;
  664. transition: .3s;
  665. .mask-content {
  666. width: 100%;
  667. min-height: 30vh;
  668. max-height: 70vh;
  669. background: #f3f3f3;
  670. transform: translateY(100%);
  671. transition: .3s;
  672. overflow-y: scroll;
  673. }
  674. &.none {
  675. display: none;
  676. }
  677. &.show {
  678. background: rgba(0, 0, 0, .4);
  679. .mask-content {
  680. transform: translateY(0);
  681. }
  682. }
  683. }
  684. /* 优惠券列表 */
  685. .coupon-item {
  686. display: flex;
  687. flex-direction: column;
  688. margin: 20upx 24upx;
  689. background: #fff;
  690. .con {
  691. display: flex;
  692. align-items: center;
  693. position: relative;
  694. height: 120upx;
  695. padding: 0 30upx;
  696. &:after {
  697. position: absolute;
  698. left: 0;
  699. bottom: 0;
  700. content: '';
  701. width: 100%;
  702. height: 0;
  703. border-bottom: 1px dashed #f3f3f3;
  704. transform: scaleY(50%);
  705. }
  706. }
  707. .left {
  708. display: flex;
  709. flex-direction: column;
  710. justify-content: center;
  711. flex: 1;
  712. overflow: hidden;
  713. height: 100upx;
  714. }
  715. .title {
  716. font-size: 32upx;
  717. color: $font-color-dark;
  718. margin-bottom: 10upx;
  719. }
  720. .time {
  721. font-size: 24upx;
  722. color: $font-color-light;
  723. }
  724. .right {
  725. display: flex;
  726. flex-direction: column;
  727. justify-content: center;
  728. align-items: center;
  729. font-size: 26upx;
  730. color: $font-color-base;
  731. height: 100upx;
  732. }
  733. .price {
  734. font-size: 44upx;
  735. color: $base-color;
  736. &:before {
  737. content: '¥';
  738. font-size: 34upx;
  739. }
  740. }
  741. .tips {
  742. font-size: 24upx;
  743. color: $font-color-light;
  744. line-height: 60upx;
  745. padding-left: 30upx;
  746. }
  747. .circle {
  748. position: absolute;
  749. left: -6upx;
  750. bottom: -10upx;
  751. z-index: 10;
  752. width: 20upx;
  753. height: 20upx;
  754. background: #f3f3f3;
  755. border-radius: 100px;
  756. &.r {
  757. left: auto;
  758. right: -6upx;
  759. }
  760. }
  761. }
  762. .rich-img {
  763. width: 100%;
  764. height: auto;
  765. margin: 0;
  766. padding: 0;
  767. line-height: 0px;
  768. }
  769. button::after {
  770. border: none;
  771. }
  772. </style>