openMember.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <view class="content">
  3. <view class="card-list">
  4. <view class="card-label">{{memberInfo.typeValue}}</view>
  5. <view class="card-num">¥{{memberInfo.originalAmount ? memberInfo.originalAmount : 0}}</view>
  6. <view class="card-icon iconfont iconzu4931"></view>
  7. </view>
  8. <u-form :model="form" label-width="140" style="width: 100%; float: left;">
  9. <u-form-item label="选择场馆" :right-icon="venueEdit ? 'arrow-right' : ''" required @click.native="venueShow = venueEdit ? true : false">
  10. <text>{{venueName}}</text>
  11. </u-form-item>
  12. <u-form-item label="使用时间">
  13. <text>{{memberInfo.startDate + '~' + memberInfo.endDate}}</text>
  14. </u-form-item>
  15. <u-form-item label="优惠金额" right-icon="arrow-right" @click.native="couponShow = true">
  16. <text>{{couponId ? '-¥' + memberInfo.discountsAmount : ''}}</text>
  17. </u-form-item>
  18. <u-form-item label="学员姓名" :right-icon="studentEdit ? 'arrow-right' : ''" required @click.native="studentShow = studentEdit ? true : false">
  19. <text>{{studentName}}</text>
  20. </u-form-item>
  21. <u-form-item label="实际金额">
  22. <text>{{'¥' + (memberInfo.realPayAmount ? memberInfo.realPayAmount : 0)}}</text>
  23. </u-form-item>
  24. <u-form-item label="家长名称" required>
  25. <u-input v-model="form.parentName" placeholder="请输入家长姓名" />
  26. </u-form-item>
  27. <u-form-item label="性别" prop="sex" required right-icon="arrow-right" @click.native="sexShow = true">
  28. <text>{{form.sex}}</text>
  29. </u-form-item>
  30. </u-form>
  31. <u-popup v-model="couponShow" mode="bottom" border-radius="30" closeable>
  32. <scroll-view scroll-y style="height:300px;margin: 30px 0 15px 0;">
  33. <u-card :show-head="false" :show-foot="false" padding="0px" margin="0px 30px 20px 30px" borderRadius="40" v-for="(item, index) in couponList"
  34. :key="index" class="class-card" @click="selectCoupon(item)">
  35. <view class="class-content" slot="body">
  36. <view class="class-info-img">
  37. <u-image width="60px" height="60px" :src="item.url" shape="circle"></u-image>
  38. </view>
  39. <view class="class-info-content">
  40. <view class="class-info-label">{{item.name}}¥{{item.amount}}</view>
  41. <view class="class-info-text">{{item.typeValue}}&nbsp;&nbsp;{{item.content}}</view>
  42. <view class="class-info-text">{{item.endDate}}&nbsp;&nbsp;到期</view>
  43. </view>
  44. </view>
  45. </u-card>
  46. </scroll-view>
  47. </u-popup>
  48. <view class="handle-fix-box">
  49. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="toPay()">确定支付¥{{memberInfo.realPayAmount ? memberInfo.realPayAmount : 0}}</u-button>
  50. </view>
  51. <u-popup v-model="venueShow" mode="bottom" border-radius="30">
  52. <scroll-view scroll-y class="student-box">
  53. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  54. margin="10px" borderRadius="20" v-for="(item, index) in venueList" :key="index" @click="selectVenue(item)">
  55. <view class="student-card" slot="body">
  56. <view class="class-info-text">{{item.venueName}}</view>
  57. </view>
  58. </u-card>
  59. </scroll-view>
  60. </u-popup>
  61. <u-popup v-model="studentShow" mode="bottom" border-radius="30">
  62. <scroll-view scroll-y class="student-box">
  63. <u-card :title="item.studentName" title-size="32" :head-style="cardStyle" :head-border-bottom="false" :show-foot="false"
  64. margin="10px" borderRadius="20" v-for="(item, index) in studentList" :key="index" @click="selectStudent(item)">
  65. <view class="student-card" slot="body">
  66. <view class="class-info-text">性别:{{item.sex}}&nbsp;&nbsp;年龄:{{item.age}}</view>
  67. </view>
  68. </u-card>
  69. </scroll-view>
  70. <u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
  71. @click="goToSubscribelForm()">新增学员</u-button>
  72. </u-popup>
  73. <u-action-sheet :list="sexList" v-model="sexShow" @click="setSex"></u-action-sheet>
  74. <u-top-tips ref="uTips"></u-top-tips>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. mapGetters
  80. } from 'vuex'
  81. const NET = require('@/utils/request')
  82. const API = require('@/config/api')
  83. export default {
  84. computed: {
  85. ...mapGetters([
  86. 'mainColor',
  87. 'customStyle',
  88. ])
  89. },
  90. data() {
  91. return {
  92. memberCardType: '',
  93. memberInfo: {
  94. id: '',
  95. originalAmount: '',
  96. discountsAmount: '',
  97. realPayAmount: '',
  98. typeValue: '',
  99. endDate: '',
  100. startDate: '',
  101. },
  102. venueEdit: true,
  103. venueId: '',
  104. venueName: '',
  105. venueShow: false,
  106. venueList: [],
  107. couponId: '',
  108. couponShow: false,
  109. couponList: [],
  110. cardStyle: {
  111. fontWeight: 'bold'
  112. },
  113. studentEdit: true,
  114. studentId: '',
  115. studentName: '',
  116. studentShow: false,
  117. studentList: [],
  118. form: {
  119. parentName: 'xsaxs',
  120. sex: '',
  121. },
  122. sexShow: false,
  123. sexList: [{
  124. text: '男'
  125. },
  126. {
  127. text: '女'
  128. }
  129. ],
  130. }
  131. },
  132. onLoad(options) {
  133. if (options.venueId) {
  134. this.venueEdit = false
  135. this.venueId = options.venueId
  136. this.venueName = options.venueName
  137. }
  138. if (options.studentId) {
  139. this.studentEdit = false
  140. this.studentId = options.studentId
  141. this.studentName = options.studentName
  142. }
  143. this.memberCardType = options.memberCardType
  144. if (this.venueId) {
  145. this.getMemberInfo(1)
  146. } else {
  147. this.memberInfo.typeValue = options.typeValue
  148. }
  149. },
  150. onShow() {
  151. NET.request(API.getAllVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  152. this.venueList = res.data
  153. }).catch(error => {
  154. this.$refs.uTips.show({
  155. title: error.message,
  156. type: 'warning',
  157. })
  158. })
  159. NET.request(API.getAllStudentList, {}, 'POST').then(res => {
  160. this.studentList = res.data
  161. }).catch(error => {
  162. this.$refs.uTips.show({
  163. title: error.message,
  164. type: 'warning',
  165. })
  166. })
  167. },
  168. onReady() {
  169. NET.request(API.getParentInfo, {}, 'POST').then(res => {
  170. this.form.parentName = res.data.parentName
  171. this.form.sex = res.data.sex
  172. }).catch(error => {
  173. this.$refs.uTips.show({
  174. title: error.message,
  175. type: 'warning',
  176. })
  177. })
  178. },
  179. methods: {
  180. // 获取数据
  181. getMemberInfo(type) {
  182. NET.request(API.getMemberCardInfo, {
  183. type: this.memberCardType,
  184. venueId: this.venueId,
  185. couponId: this.couponId,
  186. studentId: this.studentId
  187. }, 'POST').then(res => {
  188. this.memberInfo = res.data
  189. if (type == 1) {
  190. this.getCouponList()
  191. }
  192. }).catch(error => {
  193. this.$refs.uTips.show({
  194. title: error.message,
  195. type: 'warning',
  196. })
  197. this.venueId = ''
  198. this.venueName = ''
  199. this.memberInfo = {
  200. id: '',
  201. originalAmount: '',
  202. discountsAmount: '',
  203. realPayAmount: '',
  204. typeValue: this.memberInfo.typeValue,
  205. endDate: '',
  206. startDate: '',
  207. }
  208. })
  209. },
  210. // 获取优惠券
  211. getCouponList() {
  212. this.couponId = ''
  213. NET.request(API.getUsableCouponList, {
  214. id: this.memberInfo.id,
  215. studentId: this.studentId
  216. }, 'POST').then(res => {
  217. this.couponList = res.data.row
  218. }).catch(error => {
  219. this.$refs.uTips.show({
  220. title: error.message,
  221. type: 'warning',
  222. })
  223. })
  224. },
  225. // 选择优惠券
  226. selectCoupon(item) {
  227. this.couponId = item.id
  228. this.couponShow = false
  229. this.getMemberInfo(2)
  230. },
  231. // 选择场馆
  232. selectVenue(item) {
  233. this.venueId = item.id
  234. this.venueName = item.venueName
  235. this.venueShow = false
  236. this.getMemberInfo(1)
  237. },
  238. // 选择学员
  239. selectStudent(item) {
  240. this.studentId = item.studentId
  241. this.studentName = item.studentName
  242. this.studentShow = false
  243. this.getMemberInfo(1)
  244. },
  245. // 设置性别
  246. setSex(index) {
  247. this.form.sex = this.sexList[index].text
  248. },
  249. // 支付
  250. toPay(contractId) {
  251. if (!this.studentId) {
  252. this.$refs.uTips.show({
  253. title: '请选择学员',
  254. type: 'warning',
  255. })
  256. return
  257. }
  258. if (!this.form.parentName) {
  259. this.$refs.uTips.show({
  260. title: '请输入家长姓名',
  261. type: 'warning',
  262. })
  263. return
  264. }
  265. if (!this.form.sex) {
  266. this.$refs.uTips.show({
  267. title: '请选择性别',
  268. type: 'warning',
  269. })
  270. return
  271. }
  272. uni.navigateTo({
  273. url: '/pagesMain/contractInfo?memberCardId=' + this.memberInfo.id + '&couponId=' + this.couponId + '&studentId=' +
  274. this.studentId + '&realPayAmount=' + this.memberInfo.realPayAmount + '&parentName=' + this.form.parentName +
  275. '&sex=' + this.form.sex
  276. });
  277. },
  278. // 跳转支付结果
  279. goToPayResult(oderNo) {
  280. uni.redirectTo({
  281. url: '/pagesMain/payResult?id=' + oderNo
  282. });
  283. },
  284. // 跳转新增学员表单
  285. goToSubscribelForm() {
  286. uni.navigateTo({
  287. url: '/pagesMember/subscribelForm'
  288. });
  289. },
  290. },
  291. }
  292. </script>
  293. <style>
  294. page {
  295. width: 100%;
  296. height: 100%;
  297. }
  298. </style>
  299. <style lang="scss" scoped>
  300. @import "@/static/css/themes.scss";
  301. .content {
  302. width: 100%;
  303. float: left;
  304. // padding: 15px 15px 85px 15px;
  305. padding: 15px 15px 60px 15px;
  306. box-sizing: border-box;
  307. .card-list {
  308. width: 100%;
  309. padding: 15px 20px;
  310. margin-bottom: 15px;
  311. float: left;
  312. background-color: #FFFFFF;
  313. border-radius: 15px;
  314. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  315. position: relative;
  316. overflow: hidden;
  317. .card-label {
  318. width: 100%;
  319. margin-bottom: 10px;
  320. float: left;
  321. font-size: 18px;
  322. font-weight: bold;
  323. line-height: 20px;
  324. }
  325. .card-num {
  326. width: 100%;
  327. float: left;
  328. font-size: 28px;
  329. line-height: 28px;
  330. color: $mainColor;
  331. }
  332. .card-icon {
  333. font-size: 80px;
  334. color: $mainColor;
  335. position: absolute;
  336. right: -15px;
  337. bottom: -15x;
  338. opacity: 0.5;
  339. }
  340. }
  341. .class-card {
  342. .class-content {
  343. padding: 10px 15px;
  344. display: flex;
  345. align-items: center;
  346. position: relative;
  347. }
  348. .class-info-img {
  349. width: 60px;
  350. height: 60px;
  351. margin-right: 10px;
  352. }
  353. .class-info-content {
  354. flex: 1;
  355. }
  356. .class-info-label {
  357. font-size: 16px;
  358. color: #000000;
  359. word-break: break-all;
  360. }
  361. .class-info-text {
  362. color: #999999;
  363. margin-bottom: 5px;
  364. }
  365. }
  366. .student-box {
  367. max-height: 200px;
  368. padding: 0 15px;
  369. margin: 25px 0 0 0;
  370. box-sizing: border-box;
  371. overflow: auto;
  372. /deep/.u-card__head {
  373. padding-bottom: 0px !important;
  374. }
  375. }
  376. .canvas-container {
  377. width: 100%;
  378. height: 200px;
  379. }
  380. .handle-fix-box {
  381. // height: 85px;
  382. height: 60px;
  383. text-align: center;
  384. .contract-link {
  385. color: $mainColor;
  386. line-height: 25px;
  387. }
  388. }
  389. }
  390. </style>