Bladeren bron

Merge branch 'skk/feat/writeOff'

xing.li 3 jaren geleden
bovenliggende
commit
eff1e5803e
33 gewijzigde bestanden met toevoegingen van 1877 en 74 verwijderingen
  1. 40 0
      api/welfareMall.js
  2. 7 2
      app.json
  3. BIN
      images/welfareMall/close.png
  4. BIN
      images/welfareMall/open.png
  5. BIN
      images/welfareMall/search.png
  6. BIN
      images/welfareMall/staff-logo.png
  7. 2 2
      pages/luckDraw/profile.wxml
  8. 2 2
      pages/luckDraw/recordPrize.wxml
  9. 6 2
      pages/welfareMall/activityInfo/activityInfo.js
  10. 24 16
      pages/welfareMall/order/orderCompletion.js
  11. 63 1
      pages/welfareMall/personal/personal.js
  12. 39 33
      pages/welfareMall/personal/personal.wxml
  13. 73 16
      pages/welfareMall/personal/personal.wxss
  14. 131 0
      pages/welfareMall/staff/distinguish.js
  15. 6 0
      pages/welfareMall/staff/distinguish.json
  16. 3 0
      pages/welfareMall/staff/distinguish.wxml
  17. 16 0
      pages/welfareMall/staff/distinguish.wxss
  18. 100 0
      pages/welfareMall/staff/isStaff.js
  19. 7 0
      pages/welfareMall/staff/isStaff.json
  20. 18 0
      pages/welfareMall/staff/isStaff.wxml
  21. 70 0
      pages/welfareMall/staff/isStaff.wxss
  22. 104 0
      pages/welfareMall/staff/noStaff.js
  23. 7 0
      pages/welfareMall/staff/noStaff.json
  24. 18 0
      pages/welfareMall/staff/noStaff.wxml
  25. 70 0
      pages/welfareMall/staff/noStaff.wxss
  26. 290 0
      pages/welfareMall/staffManage/staffManage.js
  27. 4 0
      pages/welfareMall/staffManage/staffManage.json
  28. 30 0
      pages/welfareMall/staffManage/staffManage.wxml
  29. 202 0
      pages/welfareMall/staffManage/staffManage.wxss
  30. 240 0
      pages/welfareMall/writeOff/writeOff.js
  31. 4 0
      pages/welfareMall/writeOff/writeOff.json
  32. 59 0
      pages/welfareMall/writeOff/writeOff.wxml
  33. 242 0
      pages/welfareMall/writeOff/writeOff.wxss

+ 40 - 0
api/welfareMall.js

@@ -174,7 +174,47 @@ class WelfareMall extends request {
     return this.postRequest(`${this.BASE_URL}open/coupon/user-coupon-sn-list`, params);
   }
 
+    /**
+   * 获取核销记录
+   */
+  static getHexiaoList(params) {
+    return this.postRequest(`${this.BASE_URL}open/hexiao/list`, params);
+  }
+
+  /**
+   * 根据手机识别职员信息
+   */
+  static discernStoreStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/discern-store-staff`, params);
+  }
+
+  /**
+   * 根据职员获取门店列表
+   */
+  static getStoreListByStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/get-store-list-by-staff`, params);
+  }
 
+  /**
+   * 根据登录手机号获取职员列表
+   */
+  static getStoreStaffList(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/get-store-staff-list`, params);
+  }
+
+  /**
+   * 添加门店职员
+   */
+  static addStoreStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/add-store-staff`, params);
+  }
+
+  /**
+   * 删除门店职员
+   */
+  static delStoreStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/del-store-staff`, params);
+  }
 
 
 

+ 7 - 2
app.json

@@ -20,7 +20,12 @@
     "pages/luckDraw/index",
     "pages/luckDraw/profile",
     "pages/luckDraw/recordPrize",
-    "pages/welfareMall/coupon/coupon"
+    "pages/welfareMall/coupon/coupon",
+    "pages/welfareMall/writeOff/writeOff",
+    "pages/welfareMall/staff/isStaff",
+    "pages/welfareMall/staff/distinguish",
+    "pages/welfareMall/staff/noStaff",
+    "pages/welfareMall/staffManage/staffManage"
   ],
   "window": {
     "backgroundTextStyle": "light",
@@ -29,7 +34,7 @@
     "navigationBarTextStyle": "black"
   },
   "usingComponents": {
-    "page-wrap" : "components/pageWrap/index"
+    "page-wrap": "components/pageWrap/index"
   },
   "style": "v2",
   "sitemapLocation": "sitemap.json",

BIN
images/welfareMall/close.png


BIN
images/welfareMall/open.png


BIN
images/welfareMall/search.png


BIN
images/welfareMall/staff-logo.png


+ 2 - 2
pages/luckDraw/profile.wxml

@@ -27,7 +27,7 @@
           </view>
         </view>
         <view class="coupon-img flex-column">
-          <image class="coupon-img-url" src="{{item.fullGoodsSmallImage}}"></image>
+          <image class="coupon-img-url" src="{{item.fullGoodsBigImage}}"></image>
         </view>
       </navigator>
     </view>
@@ -48,7 +48,7 @@
         </view>
       </view>
       <view class="coupon-img flex-column">
-        <image class="coupon-img-url" src="{{item.fullGoodsSmallImage}}"></image>
+        <image class="coupon-img-url" src="{{item.fullGoodsBigImage}}"></image>
       </view>
     </view>
     <view class="no_result" wx:if="{{noResult}}">———— 抱歉,您暂无可领取奖品 ————</view>

+ 2 - 2
pages/luckDraw/recordPrize.wxml

@@ -13,7 +13,7 @@
         </view>
       </view>
       <view class="record-img flex-column">
-        <image class="record-img-url" src="{{item.fullGoodsSmallImage}}"></image>
+        <image class="record-img-url" src="{{item.fullGoodsBigImage}}"></image>
       </view>
     </navigator>
   </block>
@@ -29,7 +29,7 @@
         </view>
       </view>
       <view class="record-img flex-column">
-        <image class="record-img-url" src="{{item.fullGoodsSmallImage}}"></image>
+        <image class="record-img-url" src="{{item.fullGoodsBigImage}}"></image>
       </view>
     </view>
   </block>

+ 6 - 2
pages/welfareMall/activityInfo/activityInfo.js

@@ -151,15 +151,19 @@ Page({
       } else {
         _self.setData({
           hideWindowValue:true,
-          preventDup:true
+          // preventDup:true
         })
       }
 
     } catch (err) {
+      // this.setData({
+      //   preventDup:true
+      // })
+      app.showToast(err.msg);
+    } finally{
       this.setData({
         preventDup:true
       })
-      app.showToast(err.msg);
     }
 
   },

+ 24 - 16
pages/welfareMall/order/orderCompletion.js

@@ -18,6 +18,7 @@ Page({
     hidden: true,
     reason: '',
     inputValue: '',
+    repeat: false,
   },
 
   /**
@@ -108,10 +109,8 @@ Page({
                   });
                   that.selectOrder(that.data.orderSn);
                 }
-                that.data.lock = false
             }).catch(_ => {
                 console.log(_)
-                that.data.lock = false
             })
         }
       },
@@ -127,6 +126,10 @@ Page({
    */
   async goPay() {
       var that = this;
+      if(that.data.repeat){
+        return;
+      }
+      that.data.repeat = true;
       let result = await WelfareMall.getOrderParams(that.data.orderSn,wx.getStorageSync('loginInfo').openId);
       let res = result.data
       wx.requestPayment({
@@ -139,9 +142,15 @@ Page({
           //支付成功
           console.log(res);
           that.selectOrder(that.data.orderSn);
+          that.data.repeat = false;
         },
         fail: function (res) {
           console.log(res);
+          that.data.repeat = false;
+        },
+        complete: function (res) {
+          console.log(res);
+          that.data.repeat = false;
         }
       })
 
@@ -172,9 +181,7 @@ Page({
      * 提交
      */
     confirm: function(){
-      this.setData({
-        hidden: false
-      });
+      let that = this;
       var res = this.data.reason;
       console.log(res);
       if(res == null || res =='' || res == undefined){
@@ -184,7 +191,17 @@ Page({
           duration: 1500
         })
       } else {
-        this.goRefund(res);
+        this.setData({
+          hidden: true
+        });
+        wx.showToast({
+          title: '申请退款已提交',
+          icon: 'none',
+          duration: 2000,
+          success: function(){
+            that.goRefund(res);
+          }
+        });
       }
     },
 
@@ -210,16 +227,7 @@ Page({
     });
     await that.cancel();
     // await that.onLoad(that.options);
-    wx.showToast({
-      title: '申请退款已提交',
-      icon: 'none',
-      duration: 1500,
-      success: function(){
-        setTimeout(() => {
-          that.selectOrder(that.data.orderSn);
-        }, 1500);
-      }
-    });
+    await that.selectOrder(that.data.orderSn);
     // await wx.navigateTo({
     //   url:  "../refund/refund?orderSn=" + that.data.orderSn
     // })

+ 63 - 1
pages/welfareMall/personal/personal.js

@@ -14,6 +14,7 @@ Page({
     countNum: 0,
     grayTheme:false,
     navigationList:[],
+    couponPath: false,
   },
 
   /**
@@ -58,10 +59,40 @@ Page({
     })
   },
 
+  // 授权手机号--跳转导航栏
+  getPathCoupon(e) {
+    console.log(e)
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        console.log(nums)
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        this.getCouponPath(e);  
+    })
+  },
+
+  // 员工通道
+  getStaff(e) {
+    console.log(e)
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        console.log(nums)
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        this.toStaff(e);  
+    })
+  },
+
   // 动态获取导航栏
   async getIndexList(){
     let res =  await WelfareMall.getPersonalData();
-
+    await this.getPath(res.data.navigationList);
     this.setData({
       navigationList:res.data.navigationList,
     })
@@ -91,6 +122,23 @@ Page({
   },
 
   /**
+   * 活动列表我的券包路径
+   * @param {*} nums 
+   */
+  getPath: async function(res){
+    if(res != null && res.length > 0){
+      for(var i = 0;i<res.length;i++){
+        if("/pages/welfareMall/coupon/coupon" == res[i].path){
+         this.setData({
+           couponPath: true,
+         })    
+         return;
+        }
+      }
+   }
+  },
+
+  /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
@@ -123,6 +171,20 @@ Page({
 
   },
 
+  getCouponPath(e) {
+    const url = "/pages/welfareMall/coupon/coupon"
+    wx.navigateTo({
+        url
+    })
+  },
+
+  toStaff(e) {
+    const url = "/pages/welfareMall/staff/distinguish"
+    wx.navigateTo({
+        url
+    })
+  },
+
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 39 - 33
pages/welfareMall/personal/personal.wxml

@@ -1,46 +1,52 @@
 <!--pages/welfareMall/personal/personal.wxml-->
 <page-wrap id="Page" class="{{grayTheme?'page':''}}">
-<custom-page head-bg-color="#fff2f3">  
-  <view slot="body" class="personal flex-column">
-    <!-- 首部个人信息 -->
-    <view class="head flex-column">
-      <view class="head-personal flex-row">
-        <image wx:if="{{!isLogin}}" class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
-        <!-- 获取用户头像 -->
-        <open-data wx:if="{{isLogin}}" class="head-personal-logo" type="userAvatarUrl"></open-data>
-        <view class="head-personal-nl flex-column" wx:if="{{isLogin}}">
-          <!-- 获取用户微信昵称 -->
-          <open-data class="head-personal-name" type="userNickName" lang="zh_CN"></open-data>
-          <view class="head-personal-login">{{phone.toHide(mobileTop)}}</view>
+  <custom-page head-bg-color="#FFE7E8">
+    <view slot="body" class="personal flex-column">
+      <!-- 首部个人信息 -->
+      <view class="head flex-column">
+        <view class="head-personal flex-row">
+          <image wx:if="{{!isLogin}}" class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
+          <!-- 获取用户头像 -->
+          <view class="hat" wx:if="{{isLogin}}"></view>
+          <open-data wx:if="{{isLogin}}" class="head-personal-logo" type="userAvatarUrl"></open-data>
+          <view class="head-personal-nl flex-column" wx:if="{{isLogin}}">
+            <!-- 获取用户微信昵称 -->
+            <open-data class="head-personal-name" type="userNickName" lang="zh_CN"></open-data>
+            <view class="head-personal-login">{{phone.toHide(mobileTop)}}</view>
+          </view>
+          <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
         </view>
-        <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
-      </view>
-      <view class="head-card flex-row">
-        <view class="head-card-coupon">我的优惠券</view>
-        <view class="head-card-nt flex-row">
-          <view class="head-card-num">{{countNum}}</view>
-          <view class="head-card-text">张</view>
+        <view><button class="wx-isLogin-card" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPathCoupon"></button>
+          <view class="head-card flex-row" catchtap="{{couponPath?'getCouponPath':''}}">
+            <view class="head-card-coupon">我的优惠券</view>
+            <view class="head-card-nt flex-row">
+              <view class="head-card-num">{{countNum}}</view>
+              <view class="head-card-text">张</view>
+            </view>
+          </view>
         </view>
       </view>
-    </view>
-    <!-- 中部详细信息 -->
+      <!-- 员工通道 -->
+      <view><button class="wx-isLogin-broadcast" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getStaff"></button>
+        <view class="broadcast" catchtap="toStaff"></view>
+      </view>
       <!-- 内容 -->
       <view class="content flex-column">
-      <!-- 导航栏遍历 -->
-          <view class="sign-in content-style" wx:for="{{navigationList}}" data-appid="{{item.appId}}"  wx:key="unique">
-            <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNav" data-path="{{item.path}}"></button>
-            <view class="grant flex-row" bindtap="goToCoupon" data-path="{{item.path}}">
-              <view class="content-img-text flex-row">
-                <image class="content-img" src="{{item.figure}}"></image>
-                <view class="content-text">{{item.title}}</view>
-              </view>
-              <image class="content-jump" src="/images/welfareMall/jump.png" />
+        <!-- 导航栏遍历 -->
+        <view class="sign-in content-style" wx:for="{{navigationList}}" data-appid="{{item.appId}}" wx:key="unique">
+          <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNav" data-path="{{item.path}}"></button>
+          <view class="grant flex-row" bindtap="goToCoupon" data-path="{{item.path}}">
+            <view class="content-img-text flex-row">
+              <image class="content-img" src="{{item.figure}}"></image>
+              <view class="content-text">{{item.title}}</view>
             </view>
-            <view class="content-lower"></view>
+            <image class="content-jump" src="/images/welfareMall/jump.png" />
           </view>
+          <view class="content-lower"></view>
+        </view>
       </view>
-  </view>
-</custom-page>  
+    </view>
+  </custom-page>
 </page-wrap>
 
 <!-- 使用wxs 手机号码中间四位显示为*号 -->

+ 73 - 16
pages/welfareMall/personal/personal.wxss

@@ -1,4 +1,12 @@
 /* pages/welfareMall/personal/personal.wxss */
+page{
+  background: #F9F9F9;
+  display:flex;
+  flex-flow: column nowrap;
+  justify-content: left;
+  align-items: center;
+  box-sizing: border-box;
+}
 .personal{
   width: 750rpx;
   height: auto;
@@ -23,9 +31,9 @@
 
 .head{
   width: 750rpx;
-  height: 586rpx;
-  background: #FFF2F3;
-  border-radius: 0rpx 0rpx 40rpx 40rpx;
+  height: 352rpx;
+  background: #FFE7E8;
+  box-shadow: 0px -4px 9px 1px rgba(148, 56, 48, 0.18);
   justify-content: space-between;
 }
 
@@ -36,11 +44,25 @@
   margin-left: 35rpx;
   margin-top: 70rpx;
 }
+
+.hat{
+  width: 120rpx;
+  height: 120rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/hat.png);
+  background-size: 100% 100%;
+  position: relative;
+  z-index: 20;
+  margin-bottom: 120rpx;
+  margin-left: -20rpx;
+}
+
 .head-personal-logo{
   width: 136rpx;
   height: 136rpx;
   border-radius: 50%;
   overflow :  hidden ;
+  position: absolute;
+  z-index: 3;
 }
 
 .personal-isLogin {
@@ -55,7 +77,7 @@
 }
 
 .head-personal-nl{
-  margin-left: 33rpx;
+  margin-left: 86rpx;
   align-items: flex-start;
 }
 
@@ -73,19 +95,18 @@
 }
 
 .head-card{
-  width: 666rpx;
-  height: 286rpx;
-  background-image: url(https://dy.shpr.top/welfareGo/card.png);
-  background-size: 100% 100%;
-  margin-bottom: 51rpx;
+  width: 676rpx;
+  height: 112rpx;
+  background: #E14B3F;
+  border-radius: 20rpx 20rpx 0 0;
   justify-content: space-between;
 }
 
 .head-card-coupon{
   font-size: 30rpx;
   font-weight: bold;
-  color: #FFFFFF;
-  margin-left: 58rpx;
+  color: #F6C6A3;
+  margin-left: 60rpx;
 }
 
 .head-card-nt{
@@ -93,18 +114,18 @@
 }
 
 .head-card-num{
-  font-size: 120rpx;
+  font-size: 72rpx;
   font-weight: bold;
-  color: #FFFFFF;
+  color: #F6C6A3;
 }
 
 .head-card-text{
   width: 40rpx;
   height: 40rpx;
   font-size: 30rpx;
-  font-weight: 300;
-  color: #FFFFFF;
-  margin-top:  70rpx;
+  font-weight: bold;
+  color: #F6C6A3;
+  margin-top: 32rpx;
 }
 
 .content{
@@ -136,6 +157,33 @@
   border-style: none;
 }
 
+.wx-isLogin-card{
+  position: absolute;
+  z-index: 2;
+  width: 676rpx !important;
+  height: 112rpx !important;
+  padding: 0 !important;
+  padding-left: 0 !important;
+  margin-left: 0rpx !important;
+  margin-right: 0rpx !important;
+  background-color: transparent;
+  border-style: none;
+}
+
+.wx-isLogin-broadcast{
+  position: absolute;
+  z-index: 2;
+  width: 678rpx !important;
+  height: 130rpx !important;
+  padding: 0 !important;
+  padding-left: 0 !important;
+  margin-left: 0rpx !important;
+  margin-right: 0rpx !important;
+  background-color: transparent;
+  border-style: none;
+  margin-top: 50rpx;
+}
+
 .content-lower{
   width: 668rpx;
   height: 2rpx;
@@ -171,6 +219,15 @@
   color: #303030;
   background-color: transparent;
   border-style: none;
+  margin-left: 186rpx !important;
+}
+
+.broadcast{
+  width: 678rpx;
+  height: 130rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/broadcast.png);
+  background-size: 100% 100%;
+  margin-top: 50rpx;
 }
 
 .page{

+ 131 - 0
pages/welfareMall/staff/distinguish.js

@@ -0,0 +1,131 @@
+// pages/welfareMall/staff/distinguish.js
+import WelfareMall from '../../../api/welfareMall'
+import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    isLogin: false,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.hideShareMenu();
+    this.setData({
+      isLogin: getMobileCache() != ''
+     })
+      if(this.data.isLogin){
+        this.discernStoreStaff();
+      } else {
+        wx.switchTab({
+          url:"/pages/welfareMall/personal/personal",
+        })
+      }
+    
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  
+  discernStoreStaff: async function(){
+    /**
+     * 根据手机识别职员信息
+     */
+      // let resStaff = await WelfareMall.discernStoreStaff({
+      //   mobile: getMobileCache(),
+      // });
+      await WelfareMall.discernStoreStaff({
+        mobile: getMobileCache(),
+      }).then(res => {
+          if (res.code == 200) {
+            let resStaff = res
+            if(resStaff.data.found){
+              let staffInfo = resStaff.data;
+              let shopowner = "no";
+              if(staffInfo.staffList != null && staffInfo.staffList.length >0){
+                for(var i=0;i<staffInfo.staffList.length;i++){
+                  //判断员工是否是店长
+                  if(1 == staffInfo.staffList[i].staff.isShopowner){
+                    shopowner = "have";
+                    break;
+                  }
+                }
+              }
+              setTimeout(function () {
+                wx.redirectTo({
+                  url:"../staff/isStaff?shopowner="+shopowner,
+                })
+              }, 2000) //延迟时间
+              
+            } else {
+              setTimeout(function () {
+                wx.redirectTo({
+                  url:"../staff/noStaff"
+                })
+              }, 2000) //延迟时间
+            }
+          } else{
+            wx.switchTab({
+              url:"/pages/welfareMall/personal/personal",
+            })
+          }
+      }).catch(_ => {
+          console.log(_)
+          wx.switchTab({
+            url:"/pages/welfareMall/personal/personal",
+          })
+      })
+      
+    },
+})

+ 6 - 0
pages/welfareMall/staff/distinguish.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "topbar": "../../../components/topbar"
+  },
+  "navigationStyle": "custom"
+}

+ 3 - 0
pages/welfareMall/staff/distinguish.wxml

@@ -0,0 +1,3 @@
+<!--pages/welfareMall/staff/distinguish.wxml-->
+<!-- <topbar slot="head" title="" back-color-class="backColor" /> -->
+<image class="distinguish" src="https://dy.shpr.top/welfareGo/distinguish.gif"  mode="aspectFit" />

+ 16 - 0
pages/welfareMall/staff/distinguish.wxss

@@ -0,0 +1,16 @@
+/* pages/welfareMall/staff/distinguish.wxss */
+page{
+  height: 100%;
+  background-color: #12234e;
+}
+.distinguish{
+  width: 100%;
+  height: 100%;
+  border: none;
+  border-radius: 0;
+}
+
+.backColor{
+  color: #FFFFFF;
+  opacity: 0.9;
+}

+ 100 - 0
pages/welfareMall/staff/isStaff.js

@@ -0,0 +1,100 @@
+// pages/welfareMall/staff/judgeStaff.js
+import WelfareMall from '../../../api/welfareMall'
+import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    isLogin: false,
+    staffShow: '',
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+   wx.hideShareMenu();
+   this.setData({
+    isLogin: getMobileCache() != ''
+   })
+   if(this.data.isLogin){
+     let shopowner = options.shopowner;
+     this.setData({
+      staffShow: shopowner,
+     })
+   } else {
+      wx.switchTab({
+        url:"/pages/welfareMall/personal/personal",
+      })
+   }
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  handlePageSizes(e) {
+    this.setData({
+      bodyImageHeight: e.detail.bodyImageHeight
+    })
+  },
+  toWriteOff(e) {
+    const url = "../writeOff/writeOff"
+    wx.navigateTo({
+        url
+    })
+  },
+  toStaff(e) {
+    const url = "../staffManage/staffManage"
+    wx.navigateTo({
+        url
+    })
+  },
+})

+ 7 - 0
pages/welfareMall/staff/isStaff.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "topbar": "../../../components/topbar",
+    "custom-page": "../../../components/customPage/customPage"
+  },
+  "navigationStyle": "custom"
+}

+ 18 - 0
pages/welfareMall/staff/isStaff.wxml

@@ -0,0 +1,18 @@
+<!--pages/welfareMall/staff/isStaff.wxml-->
+<page-wrap id="Page">
+  <custom-page head-bg-image="https://dy.shpr.top/welfareGo/staffbg.png" bind:sizes="handlePageSizes">
+    <topbar slot="head" title="" back-color="" title-color="" />
+    <view slot="body" class="sign-scroll-body">
+      <view class="noStaff-head flex-column" style="height: {{bodyImageHeight}}px;">
+        <image wx:if="{{!isLogin}}" class="head-noStaff-logo" src="/images/welfareMall/staff-logo.png" />
+        <!-- 获取用户头像 -->
+        <open-data wx:if="{{isLogin}}" class="head-noStaff-logo" type="userAvatarUrl"></open-data>
+        <view class="head-text">欢迎!您进入员工通道!</view>
+      </view>
+      <view class="noStaff-content flex-column">
+        <view class="content-join" catchtap="toWriteOff"></view>
+        <view class="content-partnership" wx:if="{{staffShow == 'have'}}" catchtap="toStaff"></view>
+      </view>
+    </view>
+  </custom-page>
+</page-wrap>

+ 70 - 0
pages/welfareMall/staff/isStaff.wxss

@@ -0,0 +1,70 @@
+/* pages/welfareMall/staff/isStaff.wxss */
+page{
+  background: #F9F9F9;
+  display:flex;
+  flex-flow: column nowrap;
+  justify-content: left;
+  align-items: center;
+  box-sizing: border-box;
+}
+
+/* 垂直方向布局,水平居中 **/
+.flex-column{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  justify-content: left;
+}
+
+/* 水平方向布局,垂直居中 **/
+.flex-row{
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+  justify-content: center;
+}
+
+.noStaff-head{
+  justify-content: space-between;
+  position: relative;
+}
+
+.head-noStaff-logo{
+  width: 152rpx;
+  height: 152rpx;
+  border-radius: 50%;
+  overflow :  hidden ;
+  position: absolute;
+  bottom: 130rpx;
+}
+
+.head-text{
+  font-size: 36rpx;
+  font-weight: 500;
+  color: #F6C6A3;
+  position: absolute;
+  bottom: 34rpx;
+}
+
+.noStaff-content{
+  background: #F9F9F9;
+}
+
+.noStaff-content{
+  margin-top: 40rpx;
+}
+
+.content-join{
+  width: 676rpx;
+  height: 246rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/write-off.png);
+  background-size: 100% 100%;
+  margin-bottom: 40rpx;
+}
+
+.content-partnership{
+  width: 676rpx;
+  height: 246rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/write-off-staff.png);
+  background-size: 100% 100%;
+}

+ 104 - 0
pages/welfareMall/staff/noStaff.js

@@ -0,0 +1,104 @@
+// pages/welfareMall/staff/noStaff.js
+import WelfareMall from '../../../api/welfareMall'
+import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    isLogin: false,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.hideShareMenu();
+    this.setData({
+      isLogin: getMobileCache() != ''
+    })
+    if(!this.data.isLogin){
+      wx.switchTab({
+        url:"/pages/welfareMall/personal/personal",
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  handlePageSizes(e) {
+    this.setData({
+      bodyImageHeight: e.detail.bodyImageHeight
+    })
+  },
+  //加入我们
+  toRecurit:function(){
+    wx.navigateToMiniProgram({
+      appId: 'wxe15e2156252a1dd1',
+      path: 'pages/index/index',
+      success(res) {
+        // 打开成功
+      }
+
+    })
+  },
+  //合伙人
+  toPartnership:function(){
+    wx.navigateToMiniProgram({
+      appId: 'wx5a4f5dec0a4ac277',
+      path: 'pages/index/index',
+      success(res) {
+        // 打开成功
+      }
+
+    })
+  }
+})

+ 7 - 0
pages/welfareMall/staff/noStaff.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "topbar": "../../../components/topbar",
+    "custom-page": "../../../components/customPage/customPage"
+  },
+  "navigationStyle": "custom"
+}

+ 18 - 0
pages/welfareMall/staff/noStaff.wxml

@@ -0,0 +1,18 @@
+<!--pages/welfareMall/staff/noStaff.wxml-->
+<page-wrap id="Page">
+  <custom-page head-bg-image="https://dy.shpr.top/welfareGo/staffbg.png" bind:sizes="handlePageSizes">
+    <topbar slot="head" title="" back-color="" title-color="" />
+    <view slot="body" class="sign-scroll-body">
+      <view class="noStaff-head flex-column" style="height: {{bodyImageHeight}}px;">
+        <image wx:if="{{!isLogin}}" class="head-noStaff-logo" src="/images/welfareMall/staff-logo.png" />
+        <!-- 获取用户头像 -->
+        <open-data wx:if="{{isLogin}}" class="head-noStaff-logo" type="userAvatarUrl"></open-data>
+        <view class="head-text">抱歉!您还不是沪上阿姨员工!</view>
+      </view>
+      <view class="noStaff-content flex-column">
+        <view class="content-join" catchtap="toRecurit"></view>
+        <view class="content-partnership" catchtap="toPartnership"></view>
+      </view>
+    </view>
+  </custom-page>
+</page-wrap>

+ 70 - 0
pages/welfareMall/staff/noStaff.wxss

@@ -0,0 +1,70 @@
+/* pages/welfareMall/staff/noStaff.wxss */
+page{
+  background: #F9F9F9;
+  display:flex;
+  flex-flow: column nowrap;
+  justify-content: left;
+  align-items: center;
+  box-sizing: border-box;
+}
+
+/* 垂直方向布局,水平居中 **/
+.flex-column{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  justify-content: left;
+}
+
+/* 水平方向布局,垂直居中 **/
+.flex-row{
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+  justify-content: center;
+}
+
+.noStaff-head{
+  justify-content: space-between;
+  position: relative;
+}
+
+.head-noStaff-logo{
+  width: 152rpx;
+  height: 152rpx;
+  border-radius: 50%;
+  overflow :  hidden ;
+  position: absolute;
+  bottom: 130rpx;
+}
+
+.head-text{
+  font-size: 36rpx;
+  font-weight: 500;
+  color: #F6C6A3;
+  position: absolute;
+  bottom: 34rpx;
+}
+
+.noStaff-content{
+  background: #F9F9F9;
+}
+
+.noStaff-content{
+  margin-top: 40rpx;
+}
+
+.content-join{
+  width: 676rpx;
+  height: 246rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/write-off-join.png);
+  background-size: 100% 100%;
+  margin-bottom: 40rpx;
+}
+
+.content-partnership{
+  width: 676rpx;
+  height: 246rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/write-off-partnership.png);
+  background-size: 100% 100%;
+}

+ 290 - 0
pages/welfareMall/staffManage/staffManage.js

@@ -0,0 +1,290 @@
+// pages/welfareMall/staffManage/staffManage.js
+import WelfareMall from '../../../api/welfareMall'
+import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    isLogin: false,
+    lock: false,
+    noResult: false,
+    noMore: false,
+    hidden: true,
+    mobileTop: 'TONY WU',
+    storeStaffList: [],
+    storeInfo: '',
+    storeName: '',
+    storeNo: '',
+    storePhone: '',
+    inputName: '',
+    inputPhone: '',
+    ajxtrue: false,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.hideShareMenu();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+     this.setData({
+      isLogin: getMobileCache() != ''
+     })
+      if(this.data.isLogin){
+        this.getStoreStaffList();
+      } else {
+        wx.switchTab({
+          url:"/pages/welfareMall/personal/personal",
+        })
+      }
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+
+   // 根据登录手机号获取职员列表
+   getStoreStaffList: function() {
+    WelfareMall.getStoreStaffList({
+      mobile: getMobileCache(),
+    }).then(res => {
+        if (res.code == 200) {
+            this.userStoreStaffListView(res.data)
+        }
+        this.data.lock = false
+    }).catch(_ => {
+        console.log(_)
+        this.data.lock = false
+    })
+},
+
+  userStoreStaffListView: 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
+    }
+
+    this.data.storeStaffList = data
+    this.setData({
+        mobileTop:getMobileCache(),
+        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: '',
+          inputName: '',
+          inputPhone: '',
+        });
+    },
+    /**
+     * 提交
+     */
+    confirm: function(){
+      let that = this
+      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 if (!this.data.ajxtrue) {
+        wx.showToast({
+          title: '手机号有误,请重新输入',
+          icon: 'none',
+          duration: 1500
+         })
+       } else {
+        this.setData({
+          hidden: true
+        });
+        wx.showToast({
+          title: '新增店员已提交',
+          icon: 'none',
+          duration: 1500,
+          success: function(){
+            that.goAddStaff(resName,resPhone);
+          }
+        });
+       }
+    },
+
+    /**
+     * 店员名称
+     */
+    getName: function(e){
+      this.setData({
+        inputName: e.detail.value
+      })
+    },
+
+    /**
+     * 店员手机号
+     */
+    getPhone: function(e){
+      var phone = e.detail.value;
+      if (!(/^1[3456789]\d{9}$/.test(phone))) {
+        this.setData({
+          ajxtrue: false,
+          inputPhone: e.detail.value
+        })
+      } else {
+        this.setData({
+          ajxtrue: true,
+          inputPhone: e.detail.value
+        })
+      }
+    },
+
+  /**
+   * 
+   * 提交人员信息
+   */ 
+  goAddStaff: async function(resName,resPhone) {
+    var that = this;
+    await WelfareMall.addStoreStaff({
+      storeNo: that.data.storeNo,
+      staffName: resName,
+      staffMobile: resPhone,
+    }).then(res => {
+        if (res.code == 200) {
+          that.cancel();
+          that.getStoreStaffList();
+        }
+    }).catch(_ => {
+        console.log(_)
+    });
+  },
+
+  /**
+   * 
+   * 删除人员信息
+   */ 
+  toDelete: function(e) {
+   let staffId = e.currentTarget.dataset.id;
+   let that = this
+    wx.showModal({
+      title: '删除员工',
+      content: '',
+      showCancel: true,//是否显示取消按钮
+      cancelText:"取消",//默认是“取消”
+      cancelColor:'#00000',//取消文字的颜色
+      confirmText:"确定",//默认是“确定”
+      confirmColor: '#00000',//确定文字的颜色
+      success: res => {if (res.cancel) {
+            //点击取消,默认隐藏弹框
+        } else {
+            //点击确定 
+            WelfareMall.delStoreStaff({
+              mobile: getMobileCache(),
+              staffId: staffId,
+            }).then(res => {
+                if (res.code == 200) {
+                  that.cancel();
+                  wx.showToast({
+                    title: '员工已删除',
+                    icon: 'none',
+                    duration: 1500,
+                    success: function(){
+                      that.getStoreStaffList();
+                    }
+                  });
+                }
+                that.data.lock = false
+            }).catch(_ => {
+                console.log(_)
+                that.data.lock = false
+            })
+        }
+      },
+      fail: function (res) {
+        console.log(res)
+       },//接口调用失败的回调函数 
+    })
+    
+  },
+})

+ 4 - 0
pages/welfareMall/staffManage/staffManage.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "员工管理"
+}

+ 30 - 0
pages/welfareMall/staffManage/staffManage.wxml

@@ -0,0 +1,30 @@
+<!--pages/welfareMall/staffManage/staffManage.wxml-->
+<view class="staffManage" wx:for="{{storeStaffList}}" wx:key="index" data-storeno="{{item.storeNo}}">
+  <view class="staffManage-store flex-row">
+    <view class="store-name">{{item.storeName}}</view>
+    <view class="store-refund flex-row" catchtap="toStaffAdd" data-storename="{{item.storeName}}" data-storeno="{{item.storeNo}}">
+      <view class="lower-store-text">+ 新增店员</view>
+    </view>
+  </view>
+  <view class="staffManage-staff flex-row" wx:for="{{item.hsayStoreStaffList}}" wx:key="index" wx:for-item="list" data-storeno="{{list.storeNo}}">
+    <view class="staff-name over-ellipsis">{{list.staffName}}</view>
+    <view class="staff-phone">{{list.mobile}}</view>
+    <view class="staff-delete" catchtap="toDelete" data-id="{{list.id}}">删除员工</view>
+  </view>
+  <view class="bg-zindex" hidden="{{hidden}}">
+    <view class="success_window flex-column">
+      <view class="w_title">新增店员</view>
+      <view class="w_textNo text-top"><view class="input-style">{{storeValue}}</view></view>
+      <view class="w_text text-middle"><input bindinput="getName" type="text" placeholder="请输入店员名字" value="{{storeName}}" maxlength="10" placeholder-class="input-style" /></view>
+      <view class="w_text text-lower"><input bindinput="getPhone" type="number" placeholder="请输入店员手机号码" value="{{storePhone}}" maxlength="11" placeholder-class="input-style"/></view>
+      <view class="w_button flex-row">
+        <view class="w_go_order toCancel flex-row" catchtap="cancel">
+          <view class="text_style">取消</view>
+        </view>
+        <view class="w_go_order toDetermine flex-row" catchtap="confirm">
+          <view class="text_style">提交</view>
+        </view>
+      </view>
+    </view>
+  </view>
+</view>

+ 202 - 0
pages/welfareMall/staffManage/staffManage.wxss

@@ -0,0 +1,202 @@
+/* pages/welfareMall/staffManage/staffManage.wxss */
+page{
+  background: #F7F7F7;
+  display:flex;
+  flex-flow: column nowrap;
+  justify-content: left;
+  align-items: center;
+  box-sizing: border-box;
+}
+
+/* 垂直方向布局,水平居中 **/
+.flex-column{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  justify-content: left;
+}
+
+/* 水平方向布局,垂直居中 **/
+.flex-row{
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+  justify-content: center;
+}
+
+.staffManage{
+  margin-bottom: 34rpx;
+}
+
+.staffManage-store{
+  width: 750rpx;
+  height: 94rpx;
+  background: #FFFFFF;
+  justify-content: space-between;
+  margin-bottom: 8rpx;
+}
+
+.store-refund{
+  width: 178rpx;
+  height: 50rpx;
+  background: #D84436;
+  border-radius: 50rpx;
+  margin-right: 22rpx;
+}
+
+.lower-store-text{
+  font-size: 24rpx;
+  font-weight: 500;
+  color: #FFFFFF;
+}
+
+.store-name{
+  margin-left: 50rpx;
+  font-size: 30rpx;
+  font-weight: 500;
+  color: #444444;
+}
+
+.staffManage-staff{
+  justify-content: space-between;
+  width: 750rpx;
+  height: 140rpx;
+  background: #FFFFFF;
+}
+
+.staff-name{
+  width: 170rpx;
+  margin-left: 68rpx;
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #444444;
+}
+
+.staff-phone{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #444444;
+  padding-right: 38rpx;
+}
+
+.staff-delete{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #BD2021;
+  margin-right: 36rpx;
+}
+
+.bg-zindex{
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  top: 0;
+  background: rgba(4,4,4,0.6);
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  z-index: 999;
+}
+.success_window{
+  width: 680rpx;
+  height: 626rpx;
+  background: #FFFFFF;
+  border-radius: 20rpx;
+  position: relative;
+  z-index: 9999;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.w_title{
+  font-size: 36rpx;
+  font-weight: 500;
+  color: #444444;
+  padding-top: 50rpx;
+}
+
+.w_text{
+  width: 608rpx;
+  height: 80rpx;
+  background: #F8F8F8;
+  border: 2rpx solid #9A9A9A;
+  border-radius: 10rpx;
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+}
+
+.w_textNo{
+  width: 608rpx;
+  height: 80rpx;
+  background: #F8F8F8;
+  border-radius: 10rpx;
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+}
+
+.w_textNo view{
+  padding-left: 44rpx;
+}
+
+/* .text-top{
+  margin-top: 44rpx;
+}
+
+.text-middle{
+  margin-top: 30rpx;
+}
+
+.text-lower{
+  margin-top: 28rpx;
+} */
+
+
+.hsay_text{
+  margin-top: 8px;
+  font-size: 12px;
+  font-weight: 500;
+  color: #444444;
+}
+
+.w_button{
+  width: 680rpx;
+  height: 118rpx;
+  margin-top: 50rpx;
+}
+.w_go_order{
+  width: 50%;
+  height: 118rpx;
+  text-align: center;
+}
+
+.toCancel{
+  height: 116rpx;
+  color: #D84436;
+  background: #FFFFFF;
+  border-top: 2rpx solid #D84436;
+  border-radius: 0 0 0 20rpx;
+}
+
+.toDetermine{
+  color: #FFFFFF;
+  background: #D84436;
+  border-radius: 0 0 20rpx 0;
+}
+
+.text_style{
+  font-size: 36rpx;
+  font-weight: 500;
+}
+
+.input-style{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+}
+.w_text input{
+  width: 500rpx;
+  padding-left: 44rpx;
+}

+ 240 - 0
pages/welfareMall/writeOff/writeOff.js

@@ -0,0 +1,240 @@
+// pages/welfareMall/writeOff/writeOff.js
+import WelfareMall from '../../../api/welfareMall'
+import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    isLogin: false,
+    page: 1,
+    pageSize: 10,
+    lock: false,
+    noResult: false,
+    noMore: false,
+    mobileTop: 'TONY WU',
+    hexiaoList: [],
+    storeList: [],
+    index: 0,
+    storeNo: '',
+    date: '',
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.hideShareMenu();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.setData({
+      isLogin: getMobileCache() != ''
+     })
+      if(this.data.isLogin){
+        this.getHexiaoList();
+        this.getStoreListByStaff();
+      } else {
+        wx.switchTab({
+          url:"/pages/welfareMall/personal/personal",
+        })
+      }
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    if (this.data.lock || this.data.noMore) {
+      return
+    }
+    this.data.lock = true
+    this.data.page++
+    this.getHexiaoList();
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+
+  // 获取核销记录
+  getHexiaoList: function() {
+    WelfareMall.getHexiaoList({
+      page: this.data.page,
+      pageSize: this.data.pageSize,
+      mobile: getMobileCache(),
+      storeNo: this.data.storeNo,
+      date: this.data.date,
+    }).then(res => {
+        if (res.code == 200) {
+            this.userHexiaoListView(res.data)
+        }
+        this.data.lock = false
+    }).catch(_ => {
+        console.log(_)
+        this.data.lock = false
+    })
+},
+
+  userHexiaoListView: 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 usedTime = v.usedTime
+          v.usedTime = parseTime(usedTime, "{y}.{m}.{d} {h}:{i}:{s}")
+      })
+
+    this.data.hexiaoList = this.data.hexiaoList.concat(...data)
+    this.setData({
+        mobileTop:getMobileCache(),
+        hexiaoList: this.data.hexiaoList
+    })
+  }, 
+
+// 根据职员获取门店列表
+getStoreListByStaff: function() {
+  WelfareMall.getStoreListByStaff({
+    mobile: getMobileCache(),
+  }).then(res => {
+      if (res.code == 200) {
+          this.userstoreListView(res.data)
+      }
+      this.data.lock = false
+  }).catch(_ => {
+      console.log(_)
+      this.data.lock = false
+  })
+},
+
+userstoreListView: 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.unshift({storeNo:"",storeName:"全部门店"})
+  this.data.storeList = data
+  this.setData({
+      mobileTop:getMobileCache(),
+      storeList: this.data.storeList
+  })
+  },  
+
+  //选择门店
+  bindPickerChange: function (e) {
+    console.log(e)
+    this.setData({
+        index: e.detail.value,
+        hexiaoList: [],
+        page: 1,
+        pageSize: 10,
+        lock: false,
+        noResult: false,
+        noMore: false,
+        mobileTop: 'TONY WU',
+    })
+    let storeList = this.data.storeList
+    if(storeList != null && storeList.length > 0){
+      for(var i=0; i<storeList.length;i++){
+        if(e.detail.value == i){
+          // console.log(e.detail.value+'?'+i+'====='+storeList[i].storeNo)
+          this.setData({
+            storeNo: storeList[i].storeNo
+        })
+        break;
+        }
+      }
+    }
+    this.getHexiaoList();
+  },
+  //选择日期
+  bindDateChange: function (e) { 
+    this.setData({
+        date: e.detail.value,
+        hexiaoList: [],
+        page: 1,
+        pageSize: 10,
+        lock: false,
+        noResult: false,
+        noMore: false,
+        mobileTop: 'TONY WU',
+    })
+    this.getHexiaoList();
+  },
+
+  //清除日期
+  toCloseDet: function (e) { 
+    this.setData({
+        hexiaoList: [],
+        date: '',
+        page: 1,
+        pageSize: 10,
+        lock: false,
+        noResult: false,
+        noMore: false,
+        mobileTop: 'TONY WU',
+    })
+    this.getHexiaoList();
+  },
+})

+ 4 - 0
pages/welfareMall/writeOff/writeOff.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "核销记录"
+}

+ 59 - 0
pages/welfareMall/writeOff/writeOff.wxml

@@ -0,0 +1,59 @@
+<!--pages/welfareMall/writeOff/writeOff.wxml-->
+<view class="search">
+  <view class="store-bar flex-row">
+    <picker class="picker-store" bindchange="bindPickerChange" value="{{index}}" range="{{storeList}}" range-key="{{'storeName'}}">
+      <view class="flex-row">
+        <view class="store-text">{{storeList[index].storeName}}</view>
+        <view class="store-text" style="display: none;">{{storeList[index].storeNo}}</view>
+        <image class="store-img" src="../../../images/welfareMall/open.png" />
+      </view>
+    </picker>
+  </view>
+  <view class="writeOff-search flex-column">
+    <view class="search-bar flex-row">
+      <image class="search-img" src="../../../images/welfareMall/search.png" />
+      <view class="search-text">
+        <picker mode="date" value="{{date}}" bindchange="bindDateChange">
+          <view class="search-date flex-row">
+            <view class="picker" wx:if="{{date == null || date == ''}}">搜索分账时间</view>
+            <view class="picker" wx:else>{{date}}</view>
+            <view class="search-text-close" catchtap="toCloseDet" wx:if="{{date != null && date != ''}}">⊗</view>
+          </view>
+        </picker>
+      </view>
+    </view>
+  </view>
+</view>
+<view class="writeOff-content" wx:for="{{hexiaoList}}" wx:key="index" data-ordersn="{{item.orderSn}}">
+  <view class="writeOff-list flex-column">
+    <view class="content-head flex-row">
+      <view class="content-head-date over-ellipsis">订单号 {{item.orderSn}}</view>
+      <view class="content-head-state">{{item.statusText}}</view>
+    </view>
+    <view class="content-line line-top"></view>
+    <view class="content-middle flex-row">
+      <view class="middle-it flex-row">
+        <!-- <image class="middle-img" src="{{item.fullCoverImage}}" mode="aspectFit" /> -->
+        <image class="middle-img" wx:if="{{item.couponType == 'C'}}" src="https://dy.shpr.top/welfareGo/writeOff-cash-substitute.png" mode="aspectFit" />
+        <image class="middle-img" wx:if="{{item.couponType == 'D'}}" src="https://dy.shpr.top/welfareGo/writeOff-discount.png" mode="aspectFit" />
+        <view class="middle-text over-ellipsis">{{item.couponTitle}}</view>
+      </view>
+      <!-- <view class="middle-num flex-column">
+        <view class="middle-num-money">¥13.14</view>
+        <view class="money-num-count">x1</view>
+      </view> -->
+    </view>
+    <view class="content-line line-lower"></view>
+    <view class="content-lower-store flex-row">
+      <view class="lower-date">核销门店 {{item.storeNo}}</view>
+      <view class="lower-money">¥{{item.formatPayedPrice?item.formatPayedPrice:'0'}}</view>
+    </view>
+    <view class="content-lower-date flex-row">
+      <view class="lower-date">核销时间 {{item.usedTime?item.usedTime: ''}}</view>
+    </view>
+  </view>
+</view>
+<view class="no_record flex-column" wx:if="{{noResult}}">
+  <view class="no_record_text">暂无数据</view>
+</view>
+<view class="no_result" wx:if="{{noMore}}">—— 人家也是有底线的 ——</view>

+ 242 - 0
pages/welfareMall/writeOff/writeOff.wxss

@@ -0,0 +1,242 @@
+/* pages/welfareMall/writeOff/writeOff.wxss */
+page{
+  background: #F7F7F7;
+  display:flex;
+  flex-flow: column nowrap;
+  justify-content: left;
+  align-items: center;
+  box-sizing: border-box;
+}
+
+/* 垂直方向布局,水平居中 **/
+.flex-column{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  justify-content: left;
+}
+
+/* 水平方向布局,垂直居中 **/
+.flex-row{
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+  justify-content: center;
+}
+
+.search{
+  position: sticky;
+  top:0;
+  z-index: 99;
+}
+
+.store-bar{
+  width: 750rpx;
+  height: 88rpx;
+  background: #FFFFFF;
+  justify-content: flex-start;
+}
+
+.writeOff-search{
+  width: 750rpx;
+  height: 88rpx;
+  background: #F7F7F7;
+  justify-content: center;
+}
+
+.search-bar{
+  width: 672rpx;
+  height: 54rpx;
+  background: #FFFFFF;
+  border-radius: 28rpx;
+  justify-content: flex-start;
+}
+
+.store-img{
+  width: 34rpx;
+  height: 34rpx;
+  margin-left: 30rpx;
+}
+
+.search-img{
+  width: 34rpx;
+  height: 34rpx;
+  margin-left: 50rpx;
+}
+
+.store-text{
+  margin-left: 50rpx;
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+}
+
+.search-text{
+  width: 540rpx;
+  margin-left: 28rpx;
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+}
+
+.search-text-close{
+  font-size: 44rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+  opacity: 0.5;
+}
+
+.writeOff-content{
+  width: 750rpx;
+  margin-top: 8rpx;
+}
+
+.writeOff-list{
+  width: 750rpx;
+  height: 422rpx;
+  background: #FFFFFF;
+  border-radius: 10rpx;
+  margin-bottom: 14rpx;
+}
+
+.content-head{
+  width: 646rpx;
+  height: 22rpx;
+  justify-content: space-between;
+}
+
+.content-head-date{
+  font-size: 24rpx;
+  font-weight: 500;
+  color: #444444;
+}
+
+.content-head-state{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #BD2021;
+}
+
+.content-head{
+  width: 646rpx;
+  height: 40rpx;
+  justify-content: space-between;
+  margin-top: 36rpx;
+}
+
+.content-middle{
+  width: 646rpx;
+  height: 130rpx;
+  justify-content: space-between;
+  margin-top: 29rpx;
+}
+
+.middle-img{
+  width: 160rpx;
+  height: 119rpx;
+}
+
+.middle-text{
+  width: 240rpx;
+  height: 36rpx;
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #444444;
+  margin-left: 36rpx;
+  margin-bottom: 34rpx;
+}
+
+.middle-num{
+  align-items: flex-end;
+}
+
+.middle-num-money{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #444444;
+  margin-top: 10rpx;
+}
+
+.money-num-count{
+  font-size: 22rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+}
+
+.content-line{
+  width: 679rpx;
+  height: 1px;
+  background: #EFEFEF;
+}
+
+.line-top{
+  margin-top: 20rpx;
+}
+
+.line-lower{
+  margin-top: 34rpx;
+}
+
+.content-lower-store,.content-lower-date{
+  width: 646rpx;
+}
+
+.content-lower-store{
+  padding-top: 20rpx;
+}
+
+.lower-date{
+  font-size: 24rpx;
+  font-weight: 500;
+  color: #444444;
+  width: 500rpx;
+  line-height: 46rpx;
+  flex: 1;
+}
+
+.lower-money{
+  font-size: 36rpx;
+  font-weight: 500;
+  color: #BD2021;
+}
+
+.no_result {
+  font-size: 24rpx;
+  color: #B1B1B1;
+  line-height: 100rpx;
+  font-weight: 1000;
+}
+
+.picker-store{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+}
+
+.search-date{
+  justify-content: space-between;
+}
+
+.no_result {
+  font-size: 24rpx;
+  color: #B1B1B1;
+  line-height: 100rpx;
+  font-weight: 1000;
+  text-align: center;
+}
+
+.no_record{
+  width: 750rpx;
+  height: 550rpx;
+  background-image: url(https://dy.shpr.top/welfareGo/no-record.png);
+  background-size: 100% 100%;
+  margin-top: 80rpx;
+  justify-content: flex-end;
+}
+
+.no_record_text{
+  font-size: 30rpx;
+  font-weight: 500;
+  color: #A0A0A0;
+  margin-bottom: 32rpx;
+}