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

264 lines
6.2 KiB

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