// components/returnOrderNo/index.js const util = require("../../utils/util.js"); Component({ properties: { show:{ type: Boolean, observer: function (newVal){ this.setData({show: newVal}); } }, orderId:{ type: String, observer: function (newVal){ this.setData({orderId: newVal}); } }, refundExpressCompany:{ type: String, observer: function (newVal){ // this.setData({refundExpressCompany: newVal}); this.getExpressIndex(newVal) } }, refundExpressNum:{ type: String, observer: function (newVal){ if (newVal) { this.setData({refundExpressNum: newVal}); } } }, }, data: { show:false, orderId:'', expressList:['圆通快递', '申通快递', '韵达快递', '中通快递', '顺丰快递', '天天快递', '宅急送', '中国邮政', '百世快递', '京东快递', '德邦快递'], expressIndex:-1 }, methods: { // 获取快递公司索引 getExpressIndex(str){ if (str) { this.data.expressList.forEach((el,i) => { if (str==el) { this.setData({expressIndex:i}) } }); } }, cancel(){ this.triggerEvent('close') }, bindPickerChange(e){ this.setData({expressIndex:e.detail.value}) }, submit(e){ let data=e.detail.value; if (util.isEmpty(data.refundExpressCompany)) { util.showTips('请选择快递公司。'); return false; } if (util.isEmpty(data.refundExpressNum)) { util.showTips('请填写快递单号。'); return false; } data.orderid=this.data.orderId; this.triggerEvent('sub',data) } } })