|
@@ -11,17 +11,22 @@ Page({
|
|
|
lock: false,
|
|
|
noResult: false,
|
|
|
noMore: false,
|
|
|
+ hidden: true,
|
|
|
mobileTop: 'TONY WU',
|
|
|
- storeList: [],
|
|
|
storeStaffList: [],
|
|
|
+ storeInfo: '',
|
|
|
+ storeName: '',
|
|
|
+ storeNo: '',
|
|
|
+ storePhone: '',
|
|
|
+ inputName: '',
|
|
|
+ inputPhone: '',
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- this.getStoreListByStaff();
|
|
|
- this.getStoreStaffList();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -35,7 +40,7 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
-
|
|
|
+ this.getStoreStaffList();
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -72,48 +77,6 @@ Page({
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
},
|
|
|
- // 根据职员获取门店列表
|
|
|
- getStoreListByStaff: function() {
|
|
|
- WelfareMall.getStoreListByStaff({
|
|
|
- mobile: getMobileCache(),
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.userStaffListView(res.data)
|
|
|
- }
|
|
|
- this.data.lock = false
|
|
|
- }).catch(_ => {
|
|
|
- console.log(_)
|
|
|
- this.data.lock = false
|
|
|
- })
|
|
|
-},
|
|
|
-
|
|
|
- userStaffListView: function(data) {
|
|
|
- if (!Array.isArray(data) || data.length == 0) {
|
|
|
- console.log("门店列表数据为空");
|
|
|
- if (this.data.page == 1) {
|
|
|
- this.setData({
|
|
|
- mobileTop:getMobileCache(),
|
|
|
- noResult: true
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- mobileTop:getMobileCache(),
|
|
|
- noMore: true
|
|
|
- })
|
|
|
- }
|
|
|
- return
|
|
|
- }
|
|
|
- // data.forEach(v => {
|
|
|
- // let payeTime = v.payedAt
|
|
|
- // v.payedAt = parseTime(payeTime, "{y}.{m}.{d} {h}:{i}:{s}")
|
|
|
- // })
|
|
|
-
|
|
|
- this.data.storeList = this.data.storeList.concat(...data)
|
|
|
- this.setData({
|
|
|
- mobileTop:getMobileCache(),
|
|
|
- storeList: this.data.storeList
|
|
|
- })
|
|
|
- },
|
|
|
|
|
|
// 根据登录手机号获取职员列表
|
|
|
getStoreStaffList: function() {
|
|
@@ -157,4 +120,94 @@ Page({
|
|
|
storeStaffList: this.data.storeStaffList
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增店员
|
|
|
+ */
|
|
|
+ toStaffAdd: function(e){
|
|
|
+ this.setData({
|
|
|
+ hidden: false,
|
|
|
+ storeValue: e.currentTarget.dataset.storename,
|
|
|
+ storeNo: e.currentTarget.dataset.storeno,
|
|
|
+ storeName: '',
|
|
|
+ storePhone: '',
|
|
|
+ });
|
|
|
+},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取消
|
|
|
+ */
|
|
|
+ cancel: function(){
|
|
|
+ this.setData({
|
|
|
+ hidden: true,
|
|
|
+ storeName: '',
|
|
|
+ storePhone: '',
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 提交
|
|
|
+ */
|
|
|
+ confirm: function(){
|
|
|
+ this.setData({
|
|
|
+ hidden: false
|
|
|
+ });
|
|
|
+ var resName = this.data.inputName;
|
|
|
+ var resPhone = this.data.inputPhone;
|
|
|
+ if(resName == null || resName =='' || resName == undefined){
|
|
|
+ wx.showToast({
|
|
|
+ title: '店员名字必填',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1500
|
|
|
+ })
|
|
|
+ }else if(resPhone == null || resPhone =='' || resPhone == undefined){
|
|
|
+ wx.showToast({
|
|
|
+ title: '店员手机号码必填',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1500
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.goAddStaff(resName,resPhone);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 店员名称
|
|
|
+ */
|
|
|
+ getName: function(e){
|
|
|
+ this.setData({
|
|
|
+ inputName: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 店员手机号
|
|
|
+ */
|
|
|
+ getPhone: function(e){
|
|
|
+ this.setData({
|
|
|
+ inputPhone: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 提交人员信息
|
|
|
+ */
|
|
|
+ goAddStaff: async function(resName,resPhone) {
|
|
|
+ var that = this;
|
|
|
+ await WelfareMall.addStoreStaff({
|
|
|
+ storeNo: that.data.storeNo,
|
|
|
+ staffName: resName,
|
|
|
+ staffMobile: resPhone,
|
|
|
+ });
|
|
|
+ await that.cancel();
|
|
|
+ wx.showToast({
|
|
|
+ title: '新增店员信息已提交',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 1500,
|
|
|
+ success: function(){
|
|
|
+ that.onShow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
})
|