123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- const app = getApp()
- const util = require("../../../utils/util");
- const api = require('../../../api/api.js');
- const user = require('../../../utils/user.js');
- import moment from 'moment'
- Page({
- data: {
- evalId:'',
- skillList:[],
- sumStudyTime:'',
- currentTab:'4',
- typeList: [
- {text:'全部',value:''}
- ],
- type: '',
- date: moment(new Date()).format('YYYY-MM'),
- currentDate: new Date().getTime(),
- minDate: new Date('2022-01-01').getTime(),
- pickerShow:false,
- star:0,
- orderShow:false,
- couponList:[
- {
- name:'保洁双十一大促券199-10',
- date:'2022年11月11日至2022年11月'
- },
- {
- name:'保洁双十一大促券199-10',
- date:'2022年11月11日至2022年11月'
- }
- ],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getTypeList();
- // this.getMyCoupon();
- },
- showOrderCoupon(){
- this.setData({
- orderShow: true,
- });
- },
- onClickShow(){
- this.setData({
- orderShow: false,
- });
- },
- submitEval(){
- if(this.data.star==0){
- wx.showToast({
- title: '请选择评价星级',
- icon:'none'
- })
- }else{
- util.request(api.workerCourseScore, {
- enrolmentId:this.data.evalId,
- workerScore:this.data.star
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- wx.showToast({
- title: '评价成功',
- icon:'none'
- })
- this.setData({
- evalShow:false,
- });
- this.getMyCoupon()
- }else{
- wx.showToast({
- title: res.errmsg,
- icon:'none'
- })
- }
- });
-
- }
- },
- stop:function(){
- //阻止弹框冒泡和捕获的空事件,不要删除!!!
- },
- goStar(e){
- let id=e.currentTarget.dataset.id;
- this.setData({
- evalShow: true,
- star:0,
- evalId:id
- });
- },
- onChange(event) {
- this.setData({
- star: event.detail,
- });
- },
- getMyCoupon(){
- util.request(api.getMyCourse, {
- categorySubId:this.data.type,
- courseType:this.data.currentTab,
- studyType :'2',
- yearMonth:this.data.date
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- this.setData({
- couponList:res.data
- });
- }
-
- });
- },
-
- getTypeList(){
- util.request(api.getCategoryDict, {
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- let list=res.data;
- let current=[{text:'全部',value:''}];
- list.forEach(item=>{
- let obj={text:item.type,value:item.id};
- current.push(obj);
- });
- this.setData({
-
- typeList:current,
- type:''
- });
- }
-
- });
- },
- dropdownChange(e){
- let type=e.detail;
- this.setData({
- type:type
- });
- // this.getMyCourse();
- },
- dateSelect(){
- this.setData({
- pickerShow:true
- })
- },
- onCancel(){
- this.setData({
- pickerShow:false
- })
- },
- onConfirm(e){
- console.log(e);
- let date=moment(e.detail).format('YYYY-MM');
- this.setData({
- date:date,
- pickerShow:false
- });
- this.getMyCoupon();
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
- onHide: function () {
- },
- onUnload: function () {
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
-
- })
|