index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view v-for="(item,index) in imageList" :key="index" @tap="swichMenu(index)">
  5. <text :class="[current == index ? 'border' : '']"
  6. class="text">{{item.name}}({{item.url.length||0}})</text>
  7. </view>
  8. </view>
  9. <view class="info">
  10. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" :scroll-into-view="itemId">
  11. <view class="list-scroll-view">
  12. <view class="one" v-for="(item,index) in imageList" :key="index">
  13. <view class="text" :id="'item' + index">{{item.name}}({{item.url.length||0}})</view>
  14. <u-album :urls="item.url" @albumWidth="width => albumWidth = width"
  15. multipleSize="110"></u-album>
  16. </view>
  17. </view>
  18. </scroll-view>
  19. </view>
  20. <view class="foot">
  21. <view class="foot_1">
  22. <view class="left" @click="toChat">
  23. <u-icon color="#ffffff" name="red-packet" size="20"></u-icon>
  24. <text>分期购车</text>
  25. </view>
  26. </view>
  27. <view class="foot_2">
  28. <button class="left-btn" @click="toChat">联系卖家</button>
  29. <button class="right-btn" @click="toChat">询底价</button>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script setup lang="ts">
  35. import { getCurrentInstance, computed, ref } from 'vue';
  36. //该依赖已内置不需要单独安装
  37. import { onLoad } from "@dcloudio/uni-app";
  38. // 请求接口
  39. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  40. // openid
  41. const openid = computed(() => {
  42. return uni.getStorageSync('openid');
  43. })
  44. // 基本信息
  45. const config = ref({});
  46. const type = ref('');
  47. const current = ref(0);
  48. const itemId = ref(''); // 栏目右边scroll-view用于滚动的id
  49. const imageList = ref([{
  50. name: '外观', url: [
  51. 'https://cdn.uviewui.com/uview/album/1.jpg',
  52. 'https://cdn.uviewui.com/uview/album/2.jpg',
  53. 'https://cdn.uviewui.com/uview/album/3.jpg',
  54. 'https://cdn.uviewui.com/uview/album/4.jpg',
  55. 'https://cdn.uviewui.com/uview/album/5.jpg',
  56. 'https://cdn.uviewui.com/uview/album/6.jpg',
  57. 'https://cdn.uviewui.com/uview/album/7.jpg',
  58. 'https://cdn.uviewui.com/uview/album/8.jpg',
  59. 'https://cdn.uviewui.com/uview/album/9.jpg'
  60. ]
  61. },
  62. {
  63. name: '内饰', url: [
  64. 'https://cdn.uviewui.com/uview/album/1.jpg',
  65. 'https://cdn.uviewui.com/uview/album/2.jpg',
  66. 'https://cdn.uviewui.com/uview/album/10.jpg'
  67. ]
  68. },
  69. {
  70. name: '空间', url: [
  71. 'https://cdn.uviewui.com/uview/album/7.jpg',
  72. 'https://cdn.uviewui.com/uview/album/8.jpg',
  73. 'https://cdn.uviewui.com/uview/album/9.jpg'
  74. ]
  75. }]);
  76. onLoad(async (options) => {
  77. type.value = options && options.id
  78. await searchConfig();
  79. await searchOther();
  80. await search();
  81. })
  82. // 查询其他信息
  83. const searchOther = async () => {
  84. let res;
  85. };
  86. // config信息
  87. const searchConfig = async () => {
  88. config.value = uni.getStorageSync('config');
  89. };
  90. // 查询
  91. const search = async () => { };
  92. // 联系卖家
  93. const toChat = (item) => {
  94. uni.makePhoneCall({
  95. phoneNumber: item.shop || '110',
  96. success: function () {
  97. console.log('拨打电话成功');
  98. },
  99. fail: function () {
  100. console.log('拨打电话失败');
  101. }
  102. });
  103. };
  104. // 点击切换
  105. const swichMenu = (index) => {
  106. if (index == current.value) return;
  107. current.value = index;
  108. itemId.value = `item${index}`
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. .content {
  113. display: flex;
  114. flex-direction: column;
  115. width: 100vw;
  116. height: 100vh;
  117. color: var(--mainColor);
  118. background-color: var(--f00Color);
  119. .top {
  120. display: flex;
  121. padding: 2vw;
  122. .border {
  123. color: var(--fFFColor);
  124. }
  125. .text {
  126. padding: 2vw;
  127. font-size: var(--font16Size);
  128. font-weight: bold;
  129. }
  130. }
  131. .info {
  132. position: relative;
  133. flex-grow: 1;
  134. .one {
  135. padding: 2vw 4vw;
  136. .text {
  137. margin: 0 0 2vw 0;
  138. font-size: var(--font14Size);
  139. font-weight: bold;
  140. }
  141. .u-album {
  142. display: flex;
  143. flex-direction: column;
  144. align-items: center;
  145. }
  146. }
  147. }
  148. .foot {
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. height: 8vh;
  153. padding: 2vw 1vw;
  154. .foot_1 {
  155. display: flex;
  156. justify-content: space-between;
  157. width: 18%;
  158. .left {
  159. display: flex;
  160. flex-direction: column;
  161. align-items: center;
  162. color: var(--mainColor);
  163. font-size: var(--font14Size);
  164. }
  165. }
  166. .foot_2 {
  167. display: flex;
  168. justify-content: space-around;
  169. align-items: center;
  170. width: 85%;
  171. .left-btn {
  172. background-color: var(--fF0Color);
  173. color: var(--mainColor);
  174. font-size: var(--font16Size);
  175. }
  176. .right-btn {
  177. background-color: var(--fFFColor);
  178. color: var(--mainColor);
  179. width: 55vw;
  180. font-size: var(--font16Size);
  181. }
  182. }
  183. }
  184. }
  185. .scroll-view {
  186. position: absolute;
  187. top: 0;
  188. left: 0;
  189. right: 0;
  190. bottom: 0;
  191. .list-scroll-view {
  192. display: flex;
  193. flex-direction: column;
  194. }
  195. }
  196. </style>