合同小程序前端代码仓库
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
6.0 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
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,isToken
  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. isToken();
  55. getProduct().then((res)=>{
  56. this.product= res.result;
  57. this.product_2 = res.result[0].products;
  58. for (var index = 1; index < this.product.length; index++) {
  59. this.product_4.push(this.product[index])
  60. }
  61. this.product_3= res.result[0].products;
  62. getApp().productName = res.result[0].products[0].name;
  63. this.name = res.result[0].products[0].name;
  64. });
  65. },
  66. methods: {
  67. toBack(){
  68. let canNavBack = getCurrentPages()
  69. if( canNavBack && canNavBack.length>1) {
  70. uni.navigateBack()
  71. } else {
  72. history.back();
  73. }
  74. },
  75. toNext(){
  76. console.log(111);
  77. uni.navigateTo(
  78. { url: '/pages/index/PayPal' }
  79. )
  80. },
  81. clear (){
  82. this.ServiceName = "";
  83. },
  84. FirstLevelChange(id){
  85. this.FirstIndex = id;
  86. this.product_2 = this.product[id].products;
  87. },
  88. selctRadio(name){
  89. getApp().productName = name;
  90. this.name = name ;
  91. },
  92. handleSearch(event) {
  93. this.FirstIndex=0
  94. if(event){
  95. this.product_2 = [];
  96. for (var index = 0; index < this.product_4.length; index++) {
  97. // console.log('111',JSON.stringify(this.product_4[index].products))
  98. this.product_4[index].products.map(item => {
  99. if (item.name.indexOf(event) !== -1) {
  100. this.product_2.push(item);
  101. }
  102. });
  103. }
  104. }else {
  105. this.product_2=[];
  106. this.product_2 = this.product_3;
  107. }
  108. },
  109. searchName(){
  110. this.FirstIndex=0
  111. if(this.ServiceName){
  112. this.product_2 = [];
  113. for (var index = 0; index < this.product_4.length; index++) {
  114. this.product_4[index].products.map(item => {
  115. if (item.name.indexOf(this.ServiceName) !== -1) {
  116. this.product_2.push(item);
  117. }
  118. });
  119. }
  120. }else {
  121. this.product_2=[];
  122. this.product_2 = this.product_3;
  123. }
  124. }
  125. }
  126. }
  127. </script>
  128. <style>
  129. /* 搜索框 */
  130. .content_container{
  131. width: 100%;
  132. height: 10%;
  133. display: flex;
  134. flex-direction: row;
  135. justify-content: center;
  136. align-items: center
  137. }
  138. .content_footer{
  139. width: 100%;
  140. height: 75%;
  141. display: flex;
  142. flex-direction: row;
  143. }
  144. /* 搜索框 */
  145. /* 遮罩层 */
  146. .isshow-header{
  147. width: 90%;
  148. height: 100%;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. flex-direction: row;
  153. color: #3c7697;
  154. }
  155. .isshow-header-content-icon{
  156. width: 10%;
  157. height: 30%;
  158. }
  159. .isshow-header-content-input{
  160. width: 80%;
  161. height: 40%;
  162. margin: 0 1rem 0 1rem;
  163. border:none;
  164. outline:none;
  165. }
  166. .isshow-content{
  167. height: 70%;
  168. display: flex;
  169. flex-direction: column;
  170. align-items: center;
  171. overflow-y:scroll;
  172. }
  173. .isshow-content-text{
  174. color: #414141;
  175. height: 1.5rem;
  176. width: 100%;
  177. line-height: 1,5rem;
  178. margin: 1rem 0 1rem 0;
  179. font-size: 1.5rem;
  180. }
  181. .isshow-content::-webkit-scrollbar {
  182. display: none;
  183. }
  184. /* 二级分类 */
  185. .content_footer_left{
  186. width: 20%;
  187. }
  188. .content_footer_left_product{
  189. width: 100%;
  190. height: 10%;
  191. display: flex;
  192. justify-content: center;
  193. align-items: center;
  194. font-size: 1rem;
  195. color: #7f7f7f;
  196. }
  197. .content_footer_right{
  198. width: 80%;
  199. display: flex;
  200. flex-direction: column;
  201. align-items: center;
  202. }
  203. .content_footer_right_content{
  204. width: 100%;
  205. height: 10%;
  206. display: flex;
  207. flex-direction: row;
  208. /* background-color: red; */
  209. align-items: center;
  210. }
  211. .content_footer_right_content_text{
  212. margin-right: auto;
  213. color:#242424;
  214. margin-left: 5%;
  215. font-size: 0.8rem;
  216. }
  217. .content_footer_right_content_radio{
  218. margin-left: auto;
  219. margin-right: 5%;
  220. transform: scale(0.9);
  221. }
  222. /* 点击颜色 */
  223. .click_color{
  224. background-color: #044f7a;
  225. color: #f0fcf2;
  226. }
  227. .select_color{
  228. color: #316b8b;
  229. }
  230. /* 按钮 */
  231. .buttun{
  232. width: 30%;
  233. height: 5%;
  234. position: absolute;
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. font-size: 1.3rem;
  239. border-radius: 1.5rem;
  240. background-color: #05507c;
  241. bottom:5%;
  242. right: 5%;
  243. color: #fafcff;
  244. z-index: 99999;
  245. }
  246. </style>