| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- const _Http = getApp().globalData.http;
- Component({
- properties: {
- disabled: {
- type: Boolean,
- value: true
- }
- },
- options: {
- addGlobalClass: true
- },
- data: {
- sat_campaignid: 0,
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 10,
- pageTotal: 1,
- total: null,
- where: {
- condition: ""
- }
- },
- list: [],
- showSearch: false,
- focus: false,
- condition: ""
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- methods: {
- getList(id, init = false) {
- let content = {
- ...this.data.content,
- sat_campaignid: id || this.data.sat_campaignid
- };
- if (init) {
- content.pageNumber = 1
- content.pageTotal = 1
- }
- _Http.basic({
- "id": 2025103013521502,
- content
- }).then(res => {
- console.log("科室医生", res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- let list = res.data
- this.setData({
- "content.pageNumber": res.pageNumber + 1,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- list: res.pageNumber == 1 ? list : this.data.list.concat(list),
- sat_campaignid: content.sat_campaignid
- })
- })
- },
- insetr() {
- let params = {
- "id": 2025103013523102,
- "content": {
- "sat_campaignid": this.data.sat_campaignid,
- pageNumber: 1,
- pageSize: 20,
- "where": {
- "condition": ""
- }
- }
- };
- wx.navigateTo({
- url: '/prsx/select/docter/index?params=' + JSON.stringify(params) + '&radio=true',
- })
- let that = this;
- getApp().globalData.handleSelect = function ({
- item
- }) {
- wx.showModal({
- content: `是否确定添加“${item.doctorname}”`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 2025103013511502,
- "content": {
- "sat_campaignid": that.data.sat_campaignid,
- "doctors": [{
- "sat_campaign_doctorid": 0,
- "sa_doctorid": item.sa_doctorid,
- "amount": 0
- }]
- },
- }).then(res => {
- console.log("添加医生", res)
- wx.showToast({
- title: res.code == 1 ? '添加成功' : res.data,
- icon: 'none',
- mask:res.code == 1
- })
- if (res.code == 1) {
- that.getList("", true)
- getCurrentPages().find(v => v.__route__ == 'prsx/select/docter/index').uploadList()
- wx.navigateBack()
- }
- })
- }
- })
- console.log(item)
- }.bind(this)
- },
- toSearch() {
- if (this.data.showSearch && this.data.content.where.condition) {
- this.data.content.where.condition = '';
- this.getList("", true);
- } else if (this.data.condition) {
- this.data.content.where.condition = this.data.condition;
- this.setData({
- condition: this.data.condition
- })
- this.getList("", true);
- }
- this.setData({
- showSearch: !this.data.showSearch
- })
- setTimeout(() => {
- this.setData({
- focus: this.data.showSearch
- })
- }, 300)
- },
- onChange({
- detail
- }) {
- this.data.condition = detail;
- },
- onSearch({
- detail
- }) {
- this.data.content.where.condition = detail;
- this.getList("", true)
- },
- deleteItem(e) {
- const {
- item
- } = e.currentTarget.dataset,
- that = this;
- wx.showModal({
- content: `是否确定删除“${item.doctorname}”`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 2025103013514902,
- "content": {
- "sat_campaignid": that.data.sat_campaignid,
- "sa_doctorid": [item.sa_doctorid]
- },
- }).then(res => {
- console.log("添加医生", res)
- wx.showToast({
- title: res.code == 1 ? '删除成功' : res.data,
- icon: 'none'
- })
- if (res.code == 1) {
- that.getList("", true)
- getCurrentPages().find(v => v.__route__ == 'prsx/activity/detail').getDetail()
- }
- })
- }
- })
- },
- changeAmount(e) {
- let value = e.detail.value,
- index = e.currentTarget.dataset.index;
- this.data.list[index].amount = value;
- _Http.basic({
- "id": 2025103013511502,
- "content": {
- "sat_campaignid": this.data.sat_campaignid,
- doctors: this.data.list
- }
- }).then(res => {
- console.log("修改金额", res)
- wx.showToast({
- title: res.code == 1 ? '修改成功' : res.msg,
- icon: "none"
- })
- if (res.code == 1) getCurrentPages().find(v => v.__route__ == 'prsx/activity/detail').getDetail()
- })
- }
- }
- })
|