12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <view class="container">
- <form @submit="searchUserInfo">
- <view class="search-form flex-row flex-start">
- <input name="phone" class="input" placeholder="手机号码" />
- <button form-type="submit" size="mini" type="primary" class="button">搜索</button>
- </view>
- </form>
- <view v-if="userInfo" class="result-form">
- <view class="form-item">
- <view class="form-label">用户ID</view>
- <view class="form-value">{{ userInfo.user_id }}</view>
- </view>
- <view class="form-item">
- <view class="form-label">用户所属总店</view>
- <view class="form-value">{{ userInfo.shop_name }}</view>
- </view>
- <view class="form-item">
- <view class="form-label">用户名</view>
- <view class="form-value">{{ userInfo.user_name }}</view>
- </view>
- <view class="form-item">
- <view class="form-label">手机</view>
- <view class="form-value">{{ userInfo.phone }}</view>
- </view>
- <view class="form-item no-border">
- <view class="form-label">微信昵称</view>
- <view class="form-value">{{ userInfo.nickname }}</view>
- </view>
- </view>
- <view v-if="userInfo" class="check-btn">
- <button type="warn" plain @tap="bindCheck">确定</button>
- </view>
- </view>
- </template>
- <script>
- // pages/searchUser/searchUser.js
- var config = require('../../common/config.js');
- var http = require('../../common/http.js');
- var common = require('../../common/common.js');
- var storage = require('../../common/storage.js');
- export default {
- data() {
- return {
- userInfo: null
- };
- }
- /**
- * 生命周期函数--监听页面加载
- */,
- onLoad: function (options) {},
- methods: {
- searchUserInfo: function (e) {
- const phone = e.detail.value.phone;
- if (common.isEmpty(phone)) {
- common.simpleToast('请输入手机号码');
- return;
- }
- const that = this;
- http.postApi(
- config.API_CLIENT_GET_BY_PHONE,
- {
- phone: phone
- },
- function (resp) {
- if (resp.data.code === 200) {
- that.setData({
- userInfo: resp.data.data.userInfo
- });
- } else {
- common.simpleToast(resp.data.msg);
- }
- }
- );
- },
- bindCheck: function () {
- storage.setSearchClientUserInfo(this.userInfo);
- uni.navigateBack({
- delta: 1
- });
- }
- }
- };
- </script>
- <style>
- @import './searchUser.css';
- </style>
|