index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="main">
  3. <navbar :config="config" backColor="#666666"></navbar>
  4. <view class="service-sys-moudle">
  5. <scroll-view scroll-x class="content" scroll-with-animation @scroll="scrollPointsBox">
  6. <view class="item" v-for="(item,index) in listData" :key="index" @click="goDetail(item)">
  7. <image class="cover" :src="item.cover" mode="aspectFill"></image>
  8. <view style="height: 1px;color: transparent;">{{item.randomNum}}</view>
  9. <view class="title">{{item.title}}</view>
  10. <view class="new-price">
  11. <text class="company">¥</text>
  12. <text class="num">{{formatPrice(item.min_sale_price,'int')}}.</text>
  13. <text class="float-num">{{formatPrice(item.min_sale_price,'float')}}</text>
  14. </view>
  15. <view class="old-price">¥ {{item.min_market_price}}</view>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. <view class="split"></view>
  20. <view class="page-desc ql-editor-box">
  21. <u-parse :html="content"></u-parse>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default{
  27. data(){
  28. return {
  29. config: {
  30. back: true,
  31. title: '服务体系',
  32. color: '#1A1A1A',
  33. backgroundColor: [1, "#fff"],
  34. statusBarFontColor: '#1A1A1A'
  35. },
  36. listData: [],
  37. content: ''
  38. }
  39. },
  40. onLoad() {
  41. this.getList();
  42. this.getProtocol();
  43. },
  44. methods: {
  45. scrollPointsBox(){
  46. //获取0-10000随机数
  47. let randomNum = Math.floor(Math.random() * (10000 - 0)) + 0
  48. for(let i in this.listData){
  49. this.listData[i].randomNum = randomNum;
  50. }
  51. },
  52. /**
  53. * @param {Object} type int或float
  54. */
  55. formatPrice(price,type){
  56. let str = ''
  57. if(type=='int'){
  58. str = String(price).split('.')[0]
  59. }
  60. if(type=='float'){
  61. str = String(price).split('.').length <= 1?'00':(String(price).split('.')[1])
  62. }
  63. return str;
  64. },
  65. getList(){
  66. this.$http.get('/goodsareafeature/page',{
  67. page: 1,
  68. limit: 100,
  69. order_type: 1,
  70. order_mode: '',
  71. area_feature: 1
  72. })
  73. .then(res=>{
  74. if (res.code == 200) {
  75. let tempList = res.page.list;
  76. for(let i in tempList){
  77. tempList[i].randomNum = '';
  78. }
  79. this.listData = tempList;
  80. }
  81. })
  82. },
  83. goDetail(item){
  84. uni.navigateTo({
  85. url: `/pages/product/goods/goods?id=${item.goods_id}`
  86. })
  87. },
  88. getProtocol(){
  89. this.$http.get('/protocolConfig/info/service-agreement')
  90. .then(res => {
  91. if(res.code==200){
  92. this.content = res.data.content
  93. }
  94. })
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .main{
  101. .split{
  102. width: 100%;
  103. height: 8rpx;
  104. background: #f5f5f5;
  105. }
  106. .page-desc{
  107. padding: 30rpx;
  108. }
  109. }
  110. </style>