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

254 lines
5.9 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="container">
  3. <!-- 顶部标题 -->
  4. <view class="header">
  5. <view class="header_info" >
  6. <view class="header_info_icon" @click.native.stop.prevent="toBack" style="display: flex; justify-content: center; align-items: center;">
  7. <uni-icons type="left" size="30" color="#c2d4de" > </uni-icons>
  8. </view>
  9. <text class="header_text">录入订单</text>
  10. </view>
  11. </view>
  12. <view class="content_container">
  13. <view class="isshow-header">
  14. <uni-icons class=" isshow-header-content-icon" type="search" :size="20"></uni-icons>
  15. <uni-easyinput :inputBorder="false" @input="handleSearch" @clear="clear" class=" isshow-header-content-input" v-model="ServiceName" placeholder="请输入服务名称" :focus="firstFocus" />
  16. <text class="isshow-header-content-text" @click="searchName">搜索</text>
  17. </view>
  18. </view>
  19. <!-- 二级分类 -->
  20. <view class="content_footer">
  21. <!-- 分类 -->
  22. <scroll-view show-scrollbar="false" class="content_footer_left">
  23. <view v-for="(item,index) in product" :class="['content_footer_left_product', FirstIndex === item.categoryId?'click_color':'']" @click="FirstLevelChange(item.categoryId)">{{item.categoryName}}</view>
  24. </scroll-view>
  25. <scroll-view show-scrollbar="false" class="content_footer_right">
  26. <view v-for="(item,index) in product_2" class="content_footer_right_content">
  27. <text class="text" :class="['content_footer_right_content_text', item.name === name?'select_color':'']">{{item.name}}</text>
  28. <radio class="content_footer_right_content_radio" value="item.id" :checked="item.name == name" activeBackgroundColor="#04517b" @click="selctRadio(item.name)"></radio>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. <!-- 下一步 -->
  33. <view class="buttun" @click="toNext">下一步</view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. getProduct
  39. } from '@/api.uts'
  40. export default {
  41. data() {
  42. return {
  43. firstFocus:true,
  44. ServiceName:'',
  45. product:[],
  46. product_2:[],
  47. product_3:[],
  48. product_4:[],
  49. FirstIndex:0,
  50. name:''
  51. }
  52. },
  53. onLoad() {
  54. getProduct().then((res)=>{
  55. this.product= res.result;
  56. this.product_2 = res.result[0].products;
  57. for (var index = 1; index < this.product.length; index++) {
  58. this.product_4.push(this.product[index])
  59. }
  60. this.product_3= res.result[0].products;
  61. getApp().productName = res.result[0].products[0].name;
  62. this.name = res.result[0].products[0].name;
  63. });
  64. },
  65. methods: {
  66. toBack(){
  67. let canNavBack = getCurrentPages()
  68. if( canNavBack && canNavBack.length>1) {
  69. uni.navigateBack()
  70. } else {
  71. history.back();
  72. }
  73. },
  74. toNext(){
  75. console.log(111);
  76. uni.navigateTo(
  77. { url: '/pages/index/PayPal' }
  78. )
  79. },
  80. clear (){
  81. this.ServiceName = "";
  82. },
  83. FirstLevelChange(id){
  84. this.FirstIndex = id;
  85. this.product_2 = this.product[id].products;
  86. },
  87. selctRadio(name){
  88. getApp().productName = name;
  89. this.name = name ;
  90. },
  91. handleSearch(event) {
  92. this.FirstIndex=0
  93. if(event){
  94. this.product_2 = [];
  95. for (var index = 0; index < this.product_4.length; index++) {
  96. // console.log('111',JSON.stringify(this.product_4[index].products))
  97. this.product_4[index].products.map(item => {
  98. if (item.name.indexOf(event) !== -1) {
  99. this.product_2.push(item);
  100. }
  101. });
  102. }
  103. }else {
  104. this.product_2=[];
  105. this.product_2 = this.product_3;
  106. }
  107. },
  108. searchName(){
  109. this.FirstIndex=0
  110. if(this.ServiceName){
  111. this.product_2 = [];
  112. for (var index = 0; index < this.product_4.length; index++) {
  113. this.product_4[index].products.map(item => {
  114. if (item.name.indexOf(this.ServiceName) !== -1) {
  115. this.product_2.push(item);
  116. }
  117. });
  118. }
  119. }else {
  120. this.product_2=[];
  121. this.product_2 = this.product_3;
  122. }
  123. }
  124. }
  125. }
  126. </script>
  127. <style>
  128. /* 搜索框 */
  129. .content_container{
  130. width: 100%;
  131. height: 10%;
  132. display: flex;
  133. flex-direction: row;
  134. justify-content: center;
  135. align-items: center
  136. }
  137. .content_footer{
  138. width: 100%;
  139. height: 75%;
  140. display: flex;
  141. flex-direction: row;
  142. }
  143. /* 搜索框 */
  144. /* 遮罩层 */
  145. .isshow-header{
  146. width: 90%;
  147. height: 100%;
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. flex-direction: row;
  152. color: #3c7697;
  153. }
  154. .isshow-header-content-icon{
  155. width: 10%;
  156. height: 30%;
  157. }
  158. .isshow-header-content-input{
  159. width: 80%;
  160. height: 40%;
  161. margin: 0 1rem 0 1rem;
  162. border:none;
  163. outline:none;
  164. }
  165. .isshow-content{
  166. height: 70%;
  167. display: flex;
  168. flex-direction: column;
  169. align-items: center;
  170. overflow-y:scroll;
  171. }
  172. .isshow-content-text{
  173. color: #414141;
  174. height: 1.5rem;
  175. width: 100%;
  176. line-height: 1,5rem;
  177. margin: 1rem 0 1rem 0;
  178. font-size: 1.5rem;
  179. }
  180. .isshow-content::-webkit-scrollbar {
  181. display: none;
  182. }
  183. /* 二级分类 */
  184. .content_footer_left{
  185. width: 20%;
  186. }
  187. .content_footer_left_product{
  188. width: 100%;
  189. height: 10%;
  190. display: flex;
  191. justify-content: center;
  192. align-items: center;
  193. font-size: 1rem;
  194. color: #7f7f7f;
  195. }
  196. .content_footer_right{
  197. width: 80%;
  198. display: flex;
  199. flex-direction: column;
  200. align-items: center;
  201. }
  202. .content_footer_right_content{
  203. width: 100%;
  204. height: 10%;
  205. display: flex;
  206. flex-direction: row;
  207. /* background-color: red; */
  208. align-items: center;
  209. }
  210. .content_footer_right_content_text{
  211. margin-right: auto;
  212. color:#242424;
  213. margin-left: 5%;
  214. font-size: 0.8rem;
  215. }
  216. .content_footer_right_content_radio{
  217. margin-left: auto;
  218. margin-right: 5%;
  219. transform: scale(0.9);
  220. }
  221. /* 点击颜色 */
  222. .click_color{
  223. background-color: #044f7a;
  224. color: #f0fcf2;
  225. }
  226. .select_color{
  227. color: #316b8b;
  228. }
  229. /* 按钮 */
  230. .buttun{
  231. width: 30%;
  232. height: 5%;
  233. position: absolute;
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. font-size: 1.3rem;
  238. border-radius: 1.5rem;
  239. background-color: #05507c;
  240. bottom:5%;
  241. right: 5%;
  242. color: #fafcff;
  243. z-index: 99999;
  244. }
  245. </style>