微信小程序联调
This commit is contained in:
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.js
vendored
Normal file
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";const e=require("../../../common/vendor.js"),i=require("../../../common/request.js"),o={name:"DeviceBindPopup",data:()=>({deviceBindForm:{deviceCode:"",salesPhone:"",dealershipName:""},deviceBindSubmitting:!1}),methods:{open(){this.deviceBindForm={deviceCode:"",salesPhone:"",dealershipName:""},this.$refs.deviceBindPopup&&this.$refs.deviceBindPopup.open()},close(){this.$refs.deviceBindPopup&&this.$refs.deviceBindPopup.close()},closeDeviceBindDialog(){this.close()},async submitDeviceBind(){var o,n;if(this.deviceBindSubmitting)return;const{deviceCode:s,salesPhone:d,dealershipName:t}=this.deviceBindForm;if(!s||!s.trim())return e.index.showToast({title:"请输入设备编号",icon:"none"});this.deviceBindSubmitting=!0;try{const n={deviceCode:s.trim(),salesPhone:d?d.trim():"",dealershipName:t?t.trim():"",bindStatus:!0},c=await i.post("/api/deviceManagement/add",n);if(200===c.statusCode&&c.data&&c.data.success)this.close(),e.index.showToast({title:c.data.message||"设备绑定成功",icon:"success"}),this.$emit("success");else{const i=(null==(o=c.data)?void 0:o.message)||"设备绑定失败,请稍后重试";e.index.showToast({title:i,icon:"none"})}}catch(c){console.error("设备绑定失败:",c);const i=(null==(n=null==c?void 0:c.data)?void 0:n.message)||(null==c?void 0:c.message)||"设备绑定失败,请稍后重试";e.index.showToast({title:i,icon:"none"})}finally{this.deviceBindSubmitting=!1}}}};if(!Array){(e.resolveComponent("uni-easyinput")+e.resolveComponent("uni-popup"))()}Math||((()=>"../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js"))();const n=e._export_sfc(o,[["render",function(i,o,n,s,d,t){return{a:e.o((e=>d.deviceBindForm.deviceCode=e),"1b"),b:e.p({placeholder:"请输入设备编号",modelValue:d.deviceBindForm.deviceCode}),c:e.o((e=>d.deviceBindForm.salesPhone=e),"73"),d:e.p({placeholder:"请输入销售电话",type:"number",modelValue:d.deviceBindForm.salesPhone}),e:e.o((e=>d.deviceBindForm.dealershipName=e),"e7"),f:e.p({placeholder:"请输入所属门店",modelValue:d.deviceBindForm.dealershipName}),g:e.o(((...e)=>t.closeDeviceBindDialog&&t.closeDeviceBindDialog(...e)),"f1"),h:e.t(d.deviceBindSubmitting?"提交中...":"提交"),i:d.deviceBindSubmitting,j:e.o(((...e)=>t.submitDeviceBind&&t.submitDeviceBind(...e)),"03"),k:e.sr("deviceBindPopup","635fc302-0"),l:e.p({type:"dialog"})}}],["__scopeId","data-v-635fc302"]]);wx.createComponent(n);
|
||||
7
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.json
vendored
Normal file
7
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-easyinput": "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput",
|
||||
"uni-popup": "../../../uni_modules/uni-popup/components/uni-popup/uni-popup"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxml
vendored
Normal file
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<uni-popup wx:if="{{l}}" class="r data-v-635fc302" u-s="{{['d']}}" u-r="deviceBindPopup" u-i="635fc302-0" bind:__l="__l" u-p="{{l}}"><view class="device-bind-dialog data-v-635fc302"><view class="device-bind-title data-v-635fc302">设备绑定</view><view class="device-bind-field data-v-635fc302"><text class="device-bind-label data-v-635fc302">设备编号</text><uni-easyinput wx:if="{{b}}" class="data-v-635fc302" u-i="635fc302-1,635fc302-0" bind:__l="__l" bindupdateModelValue="{{a}}" u-p="{{b}}"/></view><view class="device-bind-field data-v-635fc302"><text class="device-bind-label data-v-635fc302">家长电话</text><uni-easyinput wx:if="{{d}}" class="data-v-635fc302" u-i="635fc302-2,635fc302-0" bind:__l="__l" bindupdateModelValue="{{c}}" u-p="{{d}}"/></view><view class="device-bind-field data-v-635fc302"><text class="device-bind-label data-v-635fc302">所属门店</text><uni-easyinput wx:if="{{f}}" class="data-v-635fc302" u-i="635fc302-3,635fc302-0" bind:__l="__l" bindupdateModelValue="{{e}}" u-p="{{f}}"/></view><view class="device-bind-actions data-v-635fc302"><button class="dialog-btn cancel data-v-635fc302" bindtap="{{g}}">取消</button><button class="dialog-btn confirm data-v-635fc302" disabled="{{i}}" bindtap="{{j}}">{{h}}</button></view></view></uni-popup>
|
||||
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxss
vendored
Normal file
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxss
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.device-bind-dialog.data-v-635fc302{padding:40rpx 30rpx 30rpx;background-color:#fff;border-radius:16rpx;width:600rpx}.device-bind-title.data-v-635fc302{font-size:34rpx;font-weight:700;text-align:center;margin-bottom:30rpx}.device-bind-field.data-v-635fc302{margin-bottom:20rpx}.device-bind-label.data-v-635fc302{display:block;font-size:26rpx;color:#666;margin-bottom:10rpx}.device-bind-actions.data-v-635fc302{margin-top:20rpx;display:flex;flex-direction:row;justify-content:flex-end}.dialog-btn.data-v-635fc302{min-width:140rpx;height:70rpx;line-height:70rpx;font-size:28rpx;border-radius:8rpx;padding:0 24rpx}.dialog-btn.cancel.data-v-635fc302{background-color:#f5f5f5;color:#333;margin-right:20rpx}.dialog-btn.confirm.data-v-635fc302{background-color:#007aff;color:#fff}.dialog-btn.data-v-635fc302:after{border:none}
|
||||
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.js
vendored
Normal file
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";const e=require("../../../common/vendor.js"),t=require("../../../common/request.js"),i={name:"DeviceListPopup",data:()=>({statusOptions:["全部状态","已绑定","未绑定"],statusIndex:0,queryDeviceCode:"",queryPhone:"",deviceList:[],page:{current:1,size:10},loading:!1,total:0,noMore:!1}),computed:{filteredDeviceList(){return this.deviceList.filter((e=>!(1===this.statusIndex&&!e.bindStatus)&&((2!==this.statusIndex||!e.bindStatus)&&(!(this.queryDeviceCode&&!(e.deviceCode||"").includes(this.queryDeviceCode.trim()))&&!(this.queryPhone&&!(e.salesPhone||"").includes(this.queryPhone.trim()))))))}},methods:{open(){this.$refs.deviceListPopup&&(this.$refs.deviceListPopup.open(),this.fetchDeviceList(!0))},close(){this.$refs.deviceListPopup&&this.$refs.deviceListPopup.close()},formatDateTime(e){if(!e)return"-";try{const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const i=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),n=String(t.getMinutes()).padStart(2,"0");return`${i}-${s}-${o} ${a}:${n}:${String(t.getSeconds()).padStart(2,"0")}`}catch(t){return console.warn("格式化时间失败:",t,e),e}},buildQueryParams(){const e={current:this.page.current,size:this.page.size},t=this.queryDeviceCode&&this.queryDeviceCode.trim(),i=this.queryPhone&&this.queryPhone.trim();return t&&(e.deviceCode=t),i&&(e.salesPhone=i),1===this.statusIndex?e.bindStatus=!0:2===this.statusIndex&&(e.bindStatus=!1),e},async fetchDeviceList(i=!1){if(!this.loading){this.loading=!0,i&&(this.page.current=1,this.noMore=!1);try{const s=this.buildQueryParams(),o=await t.get("/api/deviceManagement/list",s);if(200===o.statusCode&&o.data&&o.data.success){const e=(Array.isArray(o.data.data)?o.data.data:[]).map((e=>({id:e.id,deviceCode:e.deviceCode,salesPhone:e.salesPhone,dealershipName:e.dealershipName,bindStatus:e.bindStatus,createTime:this.formatDateTime(e.createTime)})));this.deviceList=i?e:[...this.deviceList,...e],"number"==typeof o.data.current&&(this.page.current=o.data.current),"number"==typeof o.data.size&&(this.page.size=o.data.size),"number"==typeof o.data.total&&(this.total=o.data.total);const t="number"==typeof o.data.pages?o.data.pages:Math.ceil((this.total||0)/this.page.size);this.noMore=t>0&&this.page.current>=t}else this.deviceList=[],e.index.showToast({title:o.data&&o.data.message||"获取设备列表失败",icon:"none"})}catch(s){console.error("获取设备列表失败:",s),i&&(this.deviceList=[]);let t="获取设备列表失败,请稍后重试";s.errMsg&&s.errMsg.includes("timeout")&&(t="请求超时,请检查网络后重试"),e.index.showToast({title:t,icon:"none"})}finally{this.loading=!1}}},onScrollToLower(){this.loading||this.noMore||(this.page.current+=1,this.fetchDeviceList(!1))},onStatusChange(e){this.statusIndex=Number(e.detail.value||0),this.onSearch()},onSearch(){this.fetchDeviceList(!0)},async onRefresh(){await this.fetchDeviceList(!0),e.index.showToast({title:"刷新成功",icon:"none"})}}};if(!Array){(e.resolveComponent("uni-icons")+e.resolveComponent("uni-popup"))()}Math||((()=>"../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js")+(()=>"../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js"))();const s=e._export_sfc(i,[["render",function(t,i,s,o,a,n){return e.e({a:e.p({type:"close",size:"20",color:"#666"}),b:e.o(((...e)=>n.close&&n.close(...e)),"23"),c:e.t(n.filteredDeviceList.length),d:e.t(a.statusOptions[a.statusIndex]),e:e.p({type:"down",size:"14",color:"#999"}),f:a.statusOptions,g:a.statusIndex,h:e.o(((...e)=>n.onStatusChange&&n.onStatusChange(...e)),"45"),i:e.o(((...e)=>n.onSearch&&n.onSearch(...e)),"f4"),j:a.queryDeviceCode,k:e.o((e=>a.queryDeviceCode=e.detail.value),"d5"),l:e.o(((...e)=>n.onSearch&&n.onSearch(...e)),"32"),m:a.queryPhone,n:e.o((e=>a.queryPhone=e.detail.value),"80"),o:e.p({type:"refresh",size:"18",color:"#2A68FF"}),p:e.o(((...e)=>n.onRefresh&&n.onRefresh(...e)),"c1"),q:e.f(n.filteredDeviceList,((t,i,s)=>({a:e.t(t.deviceCode||"未填写设备编号"),b:e.t(t.bindStatus?"已绑定":"未绑定"),c:e.n(t.bindStatus?"bind-tag--on":"bind-tag--off"),d:e.t(t.salesPhone||"-"),e:e.t(t.dealershipName||"-"),f:e.t(t.createTime||"-"),g:t.id||i}))),r:!a.loading&&0===a.deviceList.length},(a.loading||a.deviceList.length,{}),{s:a.deviceList.length>0},a.deviceList.length>0?e.e({t:a.loading},(a.loading||a.noMore,{}),{v:a.noMore}):{},{w:e.o(((...e)=>n.onScrollToLower&&n.onScrollToLower(...e)),"36"),x:e.sr("deviceListPopup","093708ca-0"),y:e.p({type:"bottom","safe-area":!1})})}],["__scopeId","data-v-093708ca"]]);wx.createComponent(s);
|
||||
7
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.json
vendored
Normal file
7
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni_modules/uni-icons/components/uni-icons/uni-icons",
|
||||
"uni-popup": "../../../uni_modules/uni-popup/components/uni-popup/uni-popup"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.wxml
vendored
Normal file
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<uni-popup wx:if="{{y}}" class="r data-v-093708ca" u-s="{{['d']}}" u-r="deviceListPopup" u-i="093708ca-0" bind:__l="__l" u-p="{{y}}"><view class="device-list-popup data-v-093708ca"><view class="popup-header data-v-093708ca"><text class="popup-title data-v-093708ca">设备列表</text><view class="popup-close data-v-093708ca" bindtap="{{b}}"><uni-icons wx:if="{{a}}" class="data-v-093708ca" u-i="093708ca-1,093708ca-0" bind:__l="__l" u-p="{{a}}"/></view></view><scroll-view class="device-list-content data-v-093708ca" scroll-y bindscrolltolower="{{w}}"><view class="device-toolbar data-v-093708ca"><text class="toolbar-total data-v-093708ca">{{c}}台</text><view class="toolbar-filters data-v-093708ca"><picker class="status-picker data-v-093708ca" mode="selector" range="{{f}}" value="{{g}}" bindchange="{{h}}"><view class="status-picker-inner data-v-093708ca"><text class="status-label data-v-093708ca">状态</text><text class="status-value data-v-093708ca">{{d}}</text><uni-icons wx:if="{{e}}" class="data-v-093708ca" u-i="093708ca-2,093708ca-0" bind:__l="__l" u-p="{{e}}"/></view></picker><input class="toolbar-input data-v-093708ca" placeholder="设备编号" placeholder-style="color:#B0B0B0" confirm-type="search" bindconfirm="{{i}}" value="{{j}}" bindinput="{{k}}"/><input class="toolbar-input data-v-093708ca" placeholder="电话" placeholder-style="color:#B0B0B0" confirm-type="search" bindconfirm="{{l}}" value="{{m}}" bindinput="{{n}}"/></view><view class="toolbar-actions data-v-093708ca"><view class="toolbar-btn data-v-093708ca" bindtap="{{p}}"><uni-icons wx:if="{{o}}" class="data-v-093708ca" u-i="093708ca-3,093708ca-0" bind:__l="__l" u-p="{{o}}"/><text class="data-v-093708ca">刷新</text></view></view></view><view wx:for="{{q}}" wx:for-item="item" wx:key="g" class="device-card data-v-093708ca"><view class="card-header data-v-093708ca"><text class="device-code data-v-093708ca">{{item.a}}</text><view class="{{['bind-tag', 'data-v-093708ca', item.c]}}"><text class="data-v-093708ca">{{item.b}}</text></view></view><view class="card-body data-v-093708ca"><view class="card-row data-v-093708ca"><text class="card-label data-v-093708ca">家长电话</text><text class="card-value data-v-093708ca">{{item.d}}</text></view><view class="card-row data-v-093708ca"><text class="card-label data-v-093708ca">所属门店</text><text class="card-value data-v-093708ca">{{item.e}}</text></view><view class="card-row data-v-093708ca"><text class="card-label data-v-093708ca">创建时间</text><text class="card-value data-v-093708ca">{{item.f}}</text></view></view></view><view wx:if="{{r}}" class="empty-box data-v-093708ca"><text class="empty-text data-v-093708ca">暂无设备记录</text></view><view wx:if="{{s}}" class="empty-box data-v-093708ca"><text wx:if="{{t}}" class="empty-text data-v-093708ca">加载中...</text><text wx:elif="{{v}}" class="empty-text data-v-093708ca">没有更多了</text></view></scroll-view></view></uni-popup>
|
||||
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.wxss
vendored
Normal file
1
unpackage/dist/build/mp-weixin/pages/ucenter/components/DeviceListPopup.wxss
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.device-list-popup.data-v-093708ca{background-color:#f5f5f5;border-radius:24rpx 24rpx 0 0;max-height:80vh;display:flex;flex-direction:column}.popup-header.data-v-093708ca{display:flex;align-items:center;justify-content:space-between;padding:24rpx 32rpx;background-color:#fff;border-bottom:1px solid #e0e0e0;border-radius:24rpx 24rpx 0 0}.popup-title.data-v-093708ca{font-size:36rpx;font-weight:600;color:#333}.popup-close.data-v-093708ca{padding:8rpx;display:flex;align-items:center;justify-content:center}.device-list-content.data-v-093708ca{flex:1;padding:16rpx;box-sizing:border-box}.device-toolbar.data-v-093708ca{display:flex;align-items:center;padding:12rpx;margin-bottom:24rpx;background-color:#f8f8fa;border-radius:8rpx;border:1px solid #efeff2}.toolbar-total.data-v-093708ca{font-size:24rpx;color:#666;margin-right:12rpx;flex-shrink:0}.toolbar-filters.data-v-093708ca{flex:1;display:flex;align-items:center;gap:8rpx;overflow:hidden}.status-picker.data-v-093708ca{flex-shrink:0}.status-picker-inner.data-v-093708ca{flex-direction:row;display:flex;align-items:center;padding:0 12rpx;height:56rpx;border-radius:999rpx;background-color:#fff;border:1px solid #d6e3ff}.status-label.data-v-093708ca{font-size:24rpx;color:#666;margin-right:6rpx}.status-value.data-v-093708ca{font-size:24rpx;color:#333;margin-right:4rpx}.toolbar-input.data-v-093708ca{flex:1;min-width:120rpx;height:56rpx;line-height:56rpx;background-color:#f5f6fa;border-radius:8rpx;padding:0 12rpx;font-size:24rpx;box-sizing:border-box}.toolbar-actions.data-v-093708ca{margin-left:auto;display:flex;align-items:center}.toolbar-btn.data-v-093708ca{display:flex;align-items:center;padding:0 16rpx;height:56rpx;border-radius:28rpx;background-color:#fff;border:1px solid #d6e3ff}.toolbar-btn text.data-v-093708ca{margin-left:6rpx;font-size:24rpx;color:#2a68ff}.device-card.data-v-093708ca{background-color:#fff;border-radius:16rpx;padding:24rpx 24rpx 20rpx;margin-bottom:16rpx;box-shadow:0 2rpx 8rpx rgba(0,0,0,.03)}.card-header.data-v-093708ca{display:flex;align-items:center;justify-content:space-between;margin-bottom:16rpx}.device-code.data-v-093708ca{font-size:30rpx;font-weight:600;color:#333}.bind-tag.data-v-093708ca{min-width:104rpx;padding:6rpx 16rpx;border-radius:999rpx;font-size:22rpx;text-align:center}.bind-tag--on.data-v-093708ca{background-color:#e6f6ec;color:#2e7d32}.bind-tag--off.data-v-093708ca{background-color:#fff4e5;color:#ff9800}.card-body.data-v-093708ca{border-top:1px solid #f0f0f0;padding-top:16rpx}.card-row.data-v-093708ca{display:flex;align-items:center;margin-bottom:8rpx}.card-label.data-v-093708ca{width:160rpx;font-size:24rpx;color:#999}.card-value.data-v-093708ca{font-size:26rpx;color:#333}.empty-box.data-v-093708ca{padding:80rpx 0;text-align:center}.empty-text.data-v-093708ca{font-size:26rpx;color:#999}
|
||||
Reference in New Issue
Block a user