合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
5.5 KiB

  1. <template>
  2. <view class="container">
  3. <!-- 顶部标题 -->
  4. <view class="header">
  5. <view class="header_info">
  6. <uni-icons class="header_info_icon" type="left" size="30" color="#c2d4de" :size="1" @click="toBack"></uni-icons>
  7. <text class="header_text">录入订单</text>
  8. </view>
  9. </view>
  10. <view class="content_container">
  11. <view class="isshow-header">
  12. <uni-icons class=" isshow-header-content-icon" type="search" :size="20"></uni-icons>
  13. <uni-easyinput :inputBorder="false" @input="handleSearch(ServiceName)" class=" isshow-header-content-input" v-model="ServiceName" placeholder="请输入服务名称" focus=true />
  14. <text class="isshow-header-content-text" @click="searchName">搜索</text>
  15. </view>
  16. </view>
  17. <!-- 二级分类 -->
  18. <view class="content_footer">
  19. <!-- 分类 -->
  20. <scroll-view show-scrollbar="false" class="content_footer_left">
  21. <view v-for="(item,index) in product" :class="['content_footer_left_product', FirstIndex === item.id?'click_color':'']" @click="FirstLevelChange(item.id)">{{item.name}}</view>
  22. </scroll-view>
  23. <scroll-view show-scrollbar="false" class="content_footer_right">
  24. <view v-for="(item,index) in product_2" class="content_footer_right_content">
  25. <text class="text" :class="['content_footer_right_content_text', item.name === name?'select_color':'']">{{item.name}}</text>
  26. <radio class="content_footer_right_content_radio" value="item.id" :checked="item.name == name" activeBackgroundColor="#04517b" @click="selctRadio(item.name)"></radio>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. <!-- 下一步 -->
  31. <button class="buttun" @click="toPayment">下一步</button>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. product:[
  39. {
  40. id: 1,
  41. name: '数码',
  42. children: [
  43. {
  44. id: 12,
  45. name: '耳机',
  46. children: [
  47. { id: 121, name: '漫步者' },
  48. { id: 122, name: '倍思' }
  49. ]
  50. },
  51. {
  52. id: 13,
  53. name: '电脑',
  54. children: [
  55. { id: 131, name: '联想' },
  56. { id: 132, name: '小米' },
  57. { id: 133, name: '戴尔' }
  58. ]
  59. }
  60. ]
  61. },
  62. {
  63. id: 2,
  64. name: '家用电器',
  65. // 类似数码的子结构
  66. children:[
  67. {
  68. id: 11,
  69. name: '手机',
  70. children: [
  71. { id: 111, name: 'iphone' },
  72. { id: 112, name: 'vivo' },
  73. { id: 113, name: 'oppo' }
  74. ]
  75. }
  76. ]
  77. }
  78. ],
  79. product_2:[],
  80. FirstIndex:0,
  81. name:''
  82. }
  83. },
  84. methods: {
  85. toBack(){
  86. uni.navigateBack({
  87. delta: 1
  88. });
  89. },
  90. nameClick (){
  91. },
  92. FirstLevelChange(id){
  93. this.FirstIndex = id;
  94. this.product_2 = this.product[id-1].children;
  95. },
  96. selctRadio(name){
  97. console.log(name);
  98. this.name = name;
  99. }
  100. },
  101. toPayment(){
  102. console.log(111);
  103. uni.navigateTo(
  104. { url: '/pages/views/payment' }
  105. )
  106. }
  107. }
  108. </script>
  109. <style>
  110. .container {
  111. display: flex;
  112. flex-direction: column;
  113. height: 100vh;
  114. background-color: #f5f5f5;
  115. position: relative;
  116. }
  117. /* 头部 */
  118. .header {
  119. width: 100%;
  120. height: 15%;
  121. background-color: #044f7a;
  122. color: #fff;
  123. display: flex;
  124. flex-direction: row;
  125. align-items: center;
  126. }
  127. .header_info{
  128. width: 100%;
  129. display: flex;
  130. flex-direction: row;
  131. align-items: center;
  132. color: #e0e9ef;
  133. justify-content: center;
  134. align-items: center;
  135. flex: 15;
  136. }
  137. .header_info_icon{
  138. margin-right: auto;
  139. flex: 1;
  140. }
  141. .header_text{
  142. flex: 14;
  143. display: flex;
  144. /* justify-content: center; */
  145. left:35%;
  146. align-items: center;
  147. }
  148. /* 搜索框 */
  149. .content_container{
  150. width: 100%;
  151. height: 10%;
  152. display: flex;
  153. flex-direction: row;
  154. justify-content: center;
  155. align-items: center
  156. }
  157. .content_footer{
  158. width: 100%;
  159. height: 75%;
  160. display: flex;
  161. flex-direction: row;
  162. }
  163. /* 搜索框 */
  164. /* 遮罩层 */
  165. .isshow-header{
  166. width: 90%;
  167. height: 100%;
  168. display: flex;
  169. justify-content: center;
  170. align-items: center;
  171. flex-direction: row;
  172. color: #3c7697;
  173. }
  174. .isshow-header-content-icon{
  175. width: 10%;
  176. height: 30%;
  177. }
  178. .isshow-header-content-input{
  179. width: 80%;
  180. height: 40%;
  181. margin: 0 20rpx 0 20rpx;
  182. border:none;
  183. outline:none;
  184. }
  185. .isshow-content{
  186. height: 70%;
  187. display: flex;
  188. flex-direction: column;
  189. align-items: center;
  190. overflow-y:scroll;
  191. }
  192. .isshow-content-text{
  193. color: #414141;
  194. height: 30rpx;
  195. width: 100%;
  196. line-height: 30rpx;
  197. margin: 20rpx 0 20rpx 0;
  198. font-size: 30rpx;
  199. }
  200. .isshow-content::-webkit-scrollbar {
  201. display: none;
  202. }
  203. /* 二级分类 */
  204. .content_footer_left{
  205. width: 20%;
  206. }
  207. .content_footer_left_product{
  208. width: 100%;
  209. height: 10%;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. font-size: 27rpx;
  214. color: #7f7f7f;
  215. }
  216. .content_footer_right{
  217. width: 80%;
  218. display: flex;
  219. flex-direction: column;
  220. align-items: center;
  221. }
  222. .content_footer_right_content{
  223. width: 100%;
  224. height: 10%;
  225. display: flex;
  226. flex-direction: row;
  227. /* background-color: red; */
  228. align-items: center;
  229. }
  230. .content_footer_right_content_text{
  231. margin-right: auto;
  232. color:#242424;
  233. margin-left: 5%;
  234. }
  235. .content_footer_right_content_radio{
  236. margin-left: auto;
  237. margin-right: 5%;
  238. }
  239. /* 点击颜色 */
  240. .click_color{
  241. background-color: #044f7a;
  242. color: #f0fcf2;
  243. }
  244. .select_color{
  245. color: #316b8b;
  246. }
  247. /* 按钮 */
  248. .buttun{
  249. width: 30%;
  250. position: absolute;
  251. display: flex;
  252. justify-content: center;
  253. align-items: center;
  254. font-size: 25rpx;
  255. border-radius: 30rpx;
  256. background-color: #05507c;
  257. bottom:5%;
  258. right: 5%;
  259. color: #fafcff;
  260. }
  261. </style>