setreport.vue 9.0 KB

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