goodsInputItem.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view>
  3. <view v-if="detail.templateType!=null">
  4. <u-line color="#D6D6DB" />
  5. <view v-if="detail.templateType=='class'" style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(0)">
  6. <view style="color: #666666;font-size: 24rpx;">{{gradeIndex<0?'选择班级':gradeList[gradeIndex].className}}</view>
  7. <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
  8. </view>
  9. <view v-if="detail.templateType=='apply'" style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(1)">
  10. <view style="color: #666666;font-size: 24rpx;" >{{gradeIndex<0?'报考地区':gradeList[gradeIndex].className}}</view>
  11. <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
  12. </view>
  13. </view>
  14. <u-popup v-model="show" mode="bottom"border-radius="40">
  15. <view class="popup_box">
  16. <view style="margin-bottom: 20rpx;">
  17. <view class="line1"></view>
  18. <view class="grade">选择班级</view>
  19. </view>
  20. <u-line color="#D6D6DB" />
  21. <view>
  22. <scroll-view scroll-y="true" style="height: 500rpx;">
  23. <view>
  24. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  25. <view v-for="(item, index) in gradeList" :key="index" >
  26. <view style="display: flex;align-items: center;padding: 20rpx;">
  27. <view>
  28. <u-radio
  29. shape="circle"
  30. :name="index"
  31. ></u-radio>
  32. </view>
  33. <view :class="item.checked?'white-box blue-box':'white-box'" >
  34. <view>
  35. <view class="blackTxt">{{item.className}}</view>
  36. <view class="redTxt" v-if="item.classEndTime">有效期至:{{$method.timestampToTime(item.classEndTime)}}</view>
  37. <view class="redTxt" v-if="item.classEndTime">本班还剩{{$method.GetRTime(item.classEndTime)}}天将结束学习</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </u-radio-group>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. <view class="confrim-btn">
  47. <view class="okBtn" @click="okPopup(0)">确定</view>
  48. </view>
  49. </view>
  50. </u-popup>
  51. <u-popup v-model="show1" mode="bottom"border-radius="40">
  52. <view class="popup_box">
  53. <view style="margin-bottom: 20rpx;">
  54. <view class="line1"></view>
  55. <view class="grade">选择考期/地区</view>
  56. </view>
  57. <u-line color="#D6D6DB" />
  58. <view style="display: flex;height: 500rpx;">
  59. <view style="width: 50%;">
  60. <view class="topTxt">考期</view>
  61. <view>
  62. <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChangeE" class="picker-view">
  63. <picker-view-column>
  64. <view class="picker-item" v-for="(item,index) in examine" :key="index">{{item.examineName}}</view>
  65. </picker-view-column>
  66. </picker-view>
  67. </view>
  68. </view>
  69. <view style="width: 50%;">
  70. <view class="topTxt">地区</view>
  71. <view>
  72. <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view">
  73. <picker-view-column>
  74. <view class="picker-item" v-for="(item,index) in provinceList" :key="index">{{item.areaName}}</view>
  75. </picker-view-column>
  76. <picker-view-column>
  77. <view class="picker-item" v-for="(item,index) in cityList" :key="index">{{item.areaName}}</view>
  78. </picker-view-column>
  79. </picker-view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="confrim-btn">
  84. <view class="okBtn" @click="okPopup(1)">确定</view>
  85. </view>
  86. </view>
  87. </u-popup>
  88. </view>
  89. </template>
  90. <script>
  91. import { mapGetters } from 'vuex';
  92. export default {
  93. name: 'goodsInputItem',
  94. props: {
  95. detail: {
  96. type: Object,
  97. default: {}
  98. }
  99. },
  100. data() {
  101. return {
  102. gradeValue:-1,
  103. gradeIndex:-1,
  104. show:false,
  105. show1:false,
  106. indicatorStyle: `height: 50px;`,
  107. gradeList:[],
  108. provinceList:[],
  109. cityList:[],
  110. pAreaIndex:0,
  111. cAreaIndex:0,
  112. examine:[],
  113. eAreaIndex:0,
  114. applyObj:{
  115. applyAreasJson:null,
  116. examDateJson:null
  117. }
  118. };
  119. },
  120. onLoad() {},
  121. created() {
  122. },
  123. mounted() {
  124. },
  125. methods: {
  126. openPopup(index){
  127. if(index==0){
  128. this.show = true
  129. this.goodsGradeList()
  130. }else{
  131. this.show1 = true
  132. this.getProvinceList()
  133. }
  134. },
  135. okPopup(index){
  136. if(index==0){
  137. if(!this.checkData()){
  138. return
  139. }
  140. this.gradeIndex = this.gradeValue
  141. this.show = false
  142. }else{
  143. let examDate =
  144. this.show1 = false
  145. }
  146. },
  147. checkData(){
  148. if(this.detail.templateType=='class'){
  149. if(this.gradeValue<0){
  150. uni.showModal({
  151. title: "提示",
  152. content: '请选择班级',
  153. showCancel: false
  154. })
  155. return false
  156. }
  157. }
  158. else if(this.detail.templateType=='apply'){
  159. if(!this.applyObj.applyAreasJson){
  160. uni.showModal({
  161. title: "提示",
  162. content: '请选择报考地区',
  163. showCancel: false
  164. })
  165. return false
  166. }
  167. if(!this.applyObj.examDateJson){
  168. uni.showModal({
  169. title: "提示",
  170. content: '请选择考期',
  171. showCancel: false
  172. })
  173. return false
  174. }
  175. }
  176. return true;
  177. },
  178. bindChangeE(e){
  179. console.log(e.detail.value)
  180. },
  181. bindChange(e) {
  182. const val = e.detail.value
  183. if(this.pAreaIndex!=e.detail.value[0]){
  184. this.pAreaIndex = e.detail.value[0]
  185. this.getCityList(this.provinceList[this.pAreaIndex].areaId)
  186. }
  187. if(this.cAreaIndex!=e.detail.value[1]){
  188. this.cAreaIndex = e.detail.value[1]
  189. }
  190. },
  191. getExamine(id) {
  192. let self = this
  193. this.$api.getExamine({projectId:id}).then(res => {
  194. if(res.data.code==200){
  195. self.examine = res.data.rows
  196. }
  197. });
  198. },
  199. getCityList(id) {
  200. let self = this
  201. this.$api.getCityList({parentId:id}).then(res => {
  202. if(res.data.code==200){
  203. self.cityList = res.data.rows
  204. }
  205. });
  206. },
  207. getProvinceList() {
  208. let self = this
  209. if(self.provinceList.length>0){
  210. return
  211. }
  212. this.$api.getProvinceList().then(res => {
  213. if(res.data.code==200){
  214. self.provinceList = res.data.rows
  215. if(self.provinceList.length>0){
  216. self.getCityList(self.provinceList[0].areaId)
  217. }
  218. }
  219. });
  220. },
  221. },computed: { ...mapGetters([]) },
  222. };
  223. </script>
  224. <style scoped>
  225. .icon_up{
  226. width: 24rpx;
  227. height: 24rpx;
  228. }
  229. .title{
  230. font-size: 24rpx;
  231. font-family: PingFang SC;
  232. font-weight: bold;
  233. color: #666666;
  234. white-space:nowrap;
  235. overflow:hidden;
  236. text-overflow:ellipsis;
  237. }
  238. </style>