setreport.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view>
  3. <scroll-view scroll-x class="bg-white nav margin-bottom-xs">
  4. <view class="flex text-center">
  5. <view class="cu-item flex-sub" :class="tabcur==1?'text-blue cur':''" @tap="tabSelect" :data-tabcur="1">
  6. 报备信息
  7. </view>
  8. <view class="cu-item flex-sub" :class="tabcur==2?'text-blue cur':''" @tap="tabSelect" :data-tabcur="2">
  9. 我的用户库
  10. </view>
  11. </view>
  12. </scroll-view>
  13. <view v-if="tabcur==1">
  14. <!-- <view class="setidcard" @tap="setIdcard">
  15. <image :src="$getImageUrl('static/images/applet/setidcard.png')"></image>
  16. </view> -->
  17. <form>
  18. <view class="cu-form-group">
  19. <view class="title">姓名</view>
  20. <input placeholder="请输入姓名..." @input="bindInput" data-val="realname" :value="forminfo.realname"></input>
  21. </view>
  22. <view class="cu-form-group">
  23. <view class="title">手机号</view>
  24. <input placeholder="请输入手机号..." @input="bindInput" data-val="mobile" :value="forminfo.mobile"></input>
  25. </view>
  26. <view class="cu-form-group">
  27. <view class="title">身份证号</view>
  28. <input placeholder="请输入身份证号..." @input="bindInput" data-val="idcard" :value="forminfo.idcard"></input>
  29. </view>
  30. <view class="cu-form-group">
  31. <view class="title">预计出发日期</view>
  32. <picker mode="date" :value="forminfo.arrivetime" @change="arrivetimeChange">
  33. <view class="picker">
  34. {{forminfo.arrivetime?forminfo.arrivetime:'请选择时间'}}
  35. </view>
  36. </picker>
  37. </view>
  38. <view class="cu-form-group align-start">
  39. <view class="title">报备备注</view>
  40. <textarea maxlength="140" placeholder="请输入报备备注..." @input="bindInput" data-val="remark" :value="forminfo.remark"></textarea>
  41. </view>
  42. <view class="padding flex flex-direction">
  43. <button class="cu-btn bg-blue margin-tb-sm lg" @tap="addReport">确认提交</button>
  44. </view>
  45. </form>
  46. </view>
  47. <view v-else>
  48. <view class="cu-bar search bg-white solid-bottom">
  49. <view class="search-form round">
  50. <text class="cuIcon-search"></text>
  51. <input @input="searchInput" :value="searchval" :adjust-position="false" type="text" placeholder="搜索用户昵称、姓名、手机号" confirm-type="search"></input>
  52. </view>
  53. <view class="action">
  54. <button class="cu-btn bg-blue shadow-blur round" @click="pageRefresh()">搜索</button>
  55. </view>
  56. </view>
  57. <view class="cu-list menu-avatar">
  58. <block v-for="(item,index) in plist" :key="index">
  59. <view class="cu-item" :data-index="index" @tap="checkUser">
  60. <view class="cu-avatar radius lg" :style="'background-image:url('+item.avatar+');'"></view>
  61. <view class="content">
  62. <view>
  63. <view class="text-cut">{{item.nickname}}</view>
  64. <view class="cu-tag round bg-orange sm" v-if="item.authstatus==3">{{item.authstatus_text}}</view>
  65. </view>
  66. <view class="text-gray text-sm flex"> <view class="text-cut">{{item.mobile}} - {{item.realname}}</view></view>
  67. </view>
  68. <view class="action">
  69. <text class="lg text-gray cuIcon-right"></text>
  70. </view>
  71. </view>
  72. </block>
  73. </view>
  74. <uni-load-more :status="pstatus"></uni-load-more>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  80. import avatar from "@/components/yq-avatar/yq-avatar.vue";
  81. var _this;
  82. export default {
  83. components: {
  84. avatar,
  85. uniLoadMore
  86. },
  87. data() {
  88. return {
  89. isRotate: false,
  90. userinfo: {},
  91. broker: {},
  92. snatchid: 0,
  93. tabcur: 1,
  94. pstatus: 'more',
  95. ppage: 1,
  96. psize: 20,
  97. plist: [],
  98. searchval: "",
  99. forminfo: {
  100. realname: "",
  101. mobile: "",
  102. idcard: "",
  103. arrivetime: "",
  104. remark: ""
  105. }
  106. }
  107. },
  108. onLoad: function(option) {
  109. _this = this;
  110. _this.snatchid = option.id || 0;
  111. _this.userinfo = _this.checkLogin("/pages/my/myinfo");
  112. _this.broker = uni.getStorageSync('brokerinfo');
  113. },
  114. onPullDownRefresh: function() {
  115. _this.pageRefresh();
  116. },
  117. onReachBottom: function() {
  118. if (_this.pstatus !== 'more') {
  119. return;
  120. }
  121. _this.getMore();
  122. },
  123. methods: {
  124. // 身份证识别
  125. setIdcard: function(rsp) {
  126. if(_this.isRotate){
  127. return false;
  128. }
  129. _this.isRotate = true;
  130. uni.chooseImage({
  131. count: 1,
  132. sizeType: ['original', 'compressed'],
  133. sourceType: ['album'],
  134. success: (res) => {
  135. _this.$req.ajaxFile({
  136. path: "attachment/tplfieldimage",
  137. title:'正在上传',
  138. filePath: res.tempFilePaths[0],
  139. fileName:'file',
  140. }).then((filedata) => {
  141. var fdata = JSON.parse(filedata.data);
  142. _this.$req.ajax({
  143. path: "comjobs/disidcard",
  144. title:'正在识别',
  145. data: {
  146. picpath: fdata.data.path
  147. }
  148. }).then((data) => {
  149. _this.forminfo.realname = data.idcard.name;
  150. _this.forminfo.idcard = data.idcard.num;
  151. _this.isRotate = false;
  152. }).catch((err) => {
  153. uni.showModal({
  154. title: '信息提示',
  155. content: err,
  156. showCancel: false
  157. });
  158. _this.isRotate = false;
  159. });
  160. }).catch((err) => {
  161. uni.showModal({
  162. title: '信息提示',
  163. content: err,
  164. showCancel: false
  165. });
  166. _this.isRotate = false;
  167. });
  168. }
  169. });
  170. },
  171. addReport: function() {
  172. if(_this.isRotate){
  173. return false;
  174. }
  175. _this.isRotate = true;
  176. _this.$req.ajax({
  177. path: "broker/addreport",
  178. data: {
  179. snatchid: _this.snatchid,
  180. brokerid: _this.broker.id,
  181. realname: _this.forminfo.realname,
  182. mobile: _this.forminfo.mobile,
  183. idcard: _this.forminfo.idcard,
  184. arrivetime: _this.forminfo.arrivetime,
  185. remark: _this.forminfo.remark
  186. }
  187. }).then((data) => {
  188. uni.showModal({
  189. title: '信息提示',
  190. content: "报备信息提交成功。",
  191. showCancel: false,
  192. success: function(res) {
  193. if (res.confirm) {
  194. _this.forminfo.realname = "";
  195. _this.forminfo.mobile = "";
  196. _this.forminfo.idcard = "";
  197. _this.forminfo.remark = "";
  198. }
  199. }
  200. });
  201. _this.isRotate = false;
  202. }).catch((err) => {
  203. uni.showModal({
  204. title: '信息提示',
  205. content: err,
  206. showCancel: false
  207. });
  208. _this.isRotate = false;
  209. });
  210. },
  211. checkBroker: function(e) {
  212. var index = e.currentTarget.dataset.index;
  213. _this.broker = _this.brokerall[index];
  214. },
  215. arrivetimeChange: function(e) {
  216. _this.forminfo.arrivetime = e.detail.value
  217. },
  218. bindInput: function(e) {
  219. var dataval = e.currentTarget.dataset.val;
  220. _this.forminfo[dataval] = e.detail.value;
  221. },
  222. checkUser: function(e) {
  223. var index = e.currentTarget.dataset.index;
  224. var user = _this.plist[index];
  225. _this.forminfo.realname = user.realname;
  226. _this.forminfo.mobile = user.mobile;
  227. _this.forminfo.idcard = user.idcard;
  228. _this.tabcur = 1;
  229. },
  230. pageRefresh: function() {
  231. _this.pstatus = 'more';
  232. _this.ppage = 1;
  233. _this.plist = [];
  234. _this.getMore();
  235. },
  236. searchInput: function(e) {
  237. _this.searchval = e.detail.value;
  238. },
  239. getMore: function() {
  240. _this.$req.ajax({
  241. path: "comjobs/getuserlist",
  242. data: {
  243. ppage: _this.ppage,
  244. psize: _this.psize,
  245. userid: _this.userinfo.id,
  246. searchval: _this.searchval
  247. }
  248. }).then((data) => {
  249. _this.pstatus = data.pstatus;
  250. _this.plist = _this.plist.concat(data.plist);
  251. _this.ppage += 1;
  252. uni.stopPullDownRefresh();
  253. }).catch((err) => {
  254. uni.showModal({
  255. title: '信息提示',
  256. content: err,
  257. showCancel: false
  258. });
  259. });
  260. },
  261. tabSelect: function(e) {
  262. _this.tabcur = e.currentTarget.dataset.tabcur;
  263. _this.pageRefresh();
  264. }
  265. }
  266. }
  267. </script>
  268. <style>
  269. .cu-form-group .title { min-width: calc(4em + 15px); }
  270. .cu-form-group input{ text-align: right; }
  271. .setidcard{ width: 120rpx; height: 120rpx; position: fixed; right: 60rpx; bottom: 60rpx; z-index: 999; }
  272. .setidcard image{ width: 120rpx; height: 120rpx; }
  273. </style>