合同小程序前端代码仓库
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.

255 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" @click.native.stop.prevent="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" class=" isshow-header-content-input" v-model="ServiceName" placeholder="请输入服务名称" :focus="firstFocus" />
  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. <view class="buttun" @click="toNext">下一步</view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. firstFocus:true,
  39. ServiceName:'',
  40. product:[
  41. {
  42. id: 1,
  43. name: '数码',
  44. children: [
  45. {
  46. id: 12,
  47. name: '耳机',
  48. children: [
  49. { id: 121, name: '漫步者' },
  50. { id: 122, name: '倍思' }
  51. ]
  52. },
  53. {
  54. id: 13,
  55. name: '电脑',
  56. children: [
  57. { id: 131, name: '联想' },
  58. { id: 132, name: '小米' },
  59. { id: 133, name: '戴尔' }
  60. ]
  61. }
  62. ]
  63. },
  64. {
  65. id: 2,
  66. name: '家用电器',
  67. // 类似数码的子结构
  68. children:[
  69. {
  70. id: 11,
  71. name: '手机',
  72. children: [
  73. { id: 111, name: 'iphone' },
  74. { id: 112, name: 'vivo' },
  75. { id: 113, name: 'oppo' }
  76. ]
  77. }
  78. ]
  79. }
  80. ],
  81. product_2:[],
  82. FirstIndex:0,
  83. name:''
  84. }
  85. },
  86. onLoad() {
  87. uni.request(
  88. {
  89. url: 'https://gpt.aiym.run/contract/miniapp/product/categories' ,
  90. method:'GET',
  91. header:{
  92. "Content-Type": "application/json",
  93. "X-Access-Token":'11'
  94. },
  95. success:(res)=>{
  96. console.log(res.data.result)
  97. }
  98. }
  99. );
  100. },
  101. methods: {
  102. toBack(){
  103. let canNavBack = getCurrentPages()
  104. if( canNavBack && canNavBack.length>1) {
  105. uni.navigateBack()
  106. } else {
  107. history.back();
  108. }
  109. },
  110. toNext(){
  111. console.log(111);
  112. uni.navigateTo(
  113. { url: '/pages/index/PayPal' }
  114. )
  115. },
  116. nameClick (){
  117. },
  118. FirstLevelChange(id){
  119. this.FirstIndex = id;
  120. this.product_2 = this.product[id-1].children;
  121. },
  122. selctRadio(name){
  123. console.log(name);
  124. this.name = name;
  125. }
  126. },
  127. searchName(){
  128. console.log('1');
  129. }
  130. }
  131. </script>
  132. <style>
  133. /* 搜索框 */
  134. .content_container{
  135. width: 100%;
  136. height: 10%;
  137. display: flex;
  138. flex-direction: row;
  139. justify-content: center;
  140. align-items: center
  141. }
  142. .content_footer{
  143. width: 100%;
  144. height: 75%;
  145. display: flex;
  146. flex-direction: row;
  147. }
  148. /* 搜索框 */
  149. /* 遮罩层 */
  150. .isshow-header{
  151. width: 90%;
  152. height: 100%;
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. flex-direction: row;
  157. color: #3c7697;
  158. }
  159. .isshow-header-content-icon{
  160. width: 10%;
  161. height: 30%;
  162. }
  163. .isshow-header-content-input{
  164. width: 80%;
  165. height: 40%;
  166. margin: 0 1rem 0 1rem;
  167. border:none;
  168. outline:none;
  169. }
  170. .isshow-content{
  171. height: 70%;
  172. display: flex;
  173. flex-direction: column;
  174. align-items: center;
  175. overflow-y:scroll;
  176. }
  177. .isshow-content-text{
  178. color: #414141;
  179. height: 1.5rem;
  180. width: 100%;
  181. line-height: 1,5rem;
  182. margin: 1rem 0 1rem 0;
  183. font-size: 1.5rem;
  184. }
  185. .isshow-content::-webkit-scrollbar {
  186. display: none;
  187. }
  188. /* 二级分类 */
  189. .content_footer_left{
  190. width: 20%;
  191. }
  192. .content_footer_left_product{
  193. width: 100%;
  194. height: 10%;
  195. display: flex;
  196. justify-content: center;
  197. align-items: center;
  198. font-size: 1rem;
  199. color: #7f7f7f;
  200. }
  201. .content_footer_right{
  202. width: 80%;
  203. display: flex;
  204. flex-direction: column;
  205. align-items: center;
  206. }
  207. .content_footer_right_content{
  208. width: 100%;
  209. height: 10%;
  210. display: flex;
  211. flex-direction: row;
  212. /* background-color: red; */
  213. align-items: center;
  214. }
  215. .content_footer_right_content_text{
  216. margin-right: auto;
  217. color:#242424;
  218. margin-left: 5%;
  219. font-size: 1rem;
  220. }
  221. .content_footer_right_content_radio{
  222. margin-left: auto;
  223. margin-right: 5%;
  224. }
  225. /* 点击颜色 */
  226. .click_color{
  227. background-color: #044f7a;
  228. color: #f0fcf2;
  229. }
  230. .select_color{
  231. color: #316b8b;
  232. }
  233. /* 按钮 */
  234. .buttun{
  235. width: 30%;
  236. height: 5%;
  237. position: absolute;
  238. display: flex;
  239. justify-content: center;
  240. align-items: center;
  241. font-size: 1.3rem;
  242. border-radius: 1.5rem;
  243. background-color: #05507c;
  244. bottom:5%;
  245. right: 5%;
  246. color: #fafcff;
  247. z-index: 99999;
  248. }
  249. </style>