|
|
@@ -0,0 +1,192 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+
|
|
|
+Component({
|
|
|
+ properties: {
|
|
|
+ disabled: {
|
|
|
+ type: Boolean,
|
|
|
+ value: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this)
|
|
|
+ this.setData({
|
|
|
+ siteid: wx.getStorageSync('userMsg').siteid
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ sa_service_improvementid: 0,
|
|
|
+ content: {
|
|
|
+ nocache: true,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageTotal: 1,
|
|
|
+ total: null,
|
|
|
+ where: {
|
|
|
+ condition: ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ showSearch: false,
|
|
|
+ focus: false,
|
|
|
+ condition: ""
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList(id, init = false) {
|
|
|
+ console.log("getList", id)
|
|
|
+ let content = {
|
|
|
+ ...this.data.content,
|
|
|
+ sa_service_improvementid: id || this.data.sa_service_improvementid
|
|
|
+ };
|
|
|
+ if (init) {
|
|
|
+ content.pageNumber = 1
|
|
|
+ content.pageTotal = 1
|
|
|
+ }
|
|
|
+ _Http.basic({
|
|
|
+ "id": 2026020214313702,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("影响产品产品", res)
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let list = res.data.map(v => {
|
|
|
+ try {
|
|
|
+ v.cover = v.attinfos.length ? _Http.getSpecifiedImage(v.attinfos[0]) : ''
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
+ }
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ 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),
|
|
|
+ sa_service_improvementid: content.sa_service_improvementid
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 去添加产品 */
|
|
|
+ addProduct() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/E-service/serviceBillList/product/select?params=${JSON.stringify({
|
|
|
+ "id":"2026020214323802",
|
|
|
+ "version":1,
|
|
|
+ "content":{
|
|
|
+ "pageSize":20,
|
|
|
+ "pageNumber":1,
|
|
|
+ "sa_service_improvementid":this.data.sa_service_improvementid,
|
|
|
+ "where":{"condition":""}
|
|
|
+ }})}`
|
|
|
+ });
|
|
|
+ getApp().globalData.handleSelect = this.handleSelect.bind(this)
|
|
|
+ },
|
|
|
+ /* 处理新增产品 */
|
|
|
+ handleSelect(detail) {
|
|
|
+ console.log(detail)
|
|
|
+ let that = this;
|
|
|
+ wx.showModal({
|
|
|
+ cancelText: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ confirmText: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.joint([{
|
|
|
+ v: '是否确认添加',
|
|
|
+ t: 1
|
|
|
+ }, {
|
|
|
+ v: detail.result.length,
|
|
|
+ t: 1,
|
|
|
+ r: ' ',
|
|
|
+ f: " "
|
|
|
+ }, {
|
|
|
+ v: '件商品',
|
|
|
+ t: 1,
|
|
|
+ r: '?',
|
|
|
+ }]),
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) _Http.basic({
|
|
|
+ "id": "2026020214301002",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ sa_service_improvementid: this.data.sa_service_improvementid,
|
|
|
+ "itemids": detail.list.map(v => v.itemid)
|
|
|
+ },
|
|
|
+ }).then(s => {
|
|
|
+ console.log('新增产品', s)
|
|
|
+ wx.showToast({
|
|
|
+ title: s.code == '1' ? getApp().globalData.Language.getMapText('添加成功') : s.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (s.code == '1') setTimeout(() => {
|
|
|
+ that.getList('', true);
|
|
|
+ wx.navigateBack();
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deleteItem(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset,
|
|
|
+ that = this;
|
|
|
+ wx.showModal({
|
|
|
+ content: getApp().globalData.Language.getMapText(`是否确定删除该产品`),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id": "2026020214312002",
|
|
|
+ "content": {
|
|
|
+ "sa_service_improvement_itemsid": item.sa_service_improvement_itemsid
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == 1 ? getApp().globalData.Language.getMapText(`删除成功`) : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ if (res.code == 1) {
|
|
|
+ that.getList('', true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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)
|
|
|
+ },
|
|
|
+ }
|
|
|
+})
|