You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. <template>
  2. <view>
  3. <view>
  4. <view class="cu-bar bg-white solid-bottom " v-if="showunloadlist">
  5. <view class="action">
  6. <text class="cuIcon-titles text-orange "></text>待上传客户列表
  7. </view>
  8. </view>
  9. <view class="padding-x" v-if="showunloadlist">
  10. <scroll-view class="scroll-view_H" scroll-x="true" scroll-left="120">
  11. <view class="flex" >
  12. <view class=" margin-l20 customer-list flex align-center "
  13. v-for="(item,index) in customerlist" :key="index" @click="tosel(index,item)">
  14. <view class="customer-title padding radius" :data-id="index"
  15. :class="index==selidx?'text-white bg-gradual-blue at-item':'bg-gray'">
  16. {{item}}
  17. </view>
  18. </view>
  19. <view class=" margin-l20 customer-list flex align-center " v-if="!showunloadlist">
  20. <view class="customer-title padding radius bg-gray justify-center" >
  21. 暂无信息
  22. </view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. </view>
  27. <!-- <view v-if="!showunloadlist">
  28. <view class="flex-row">待上传客户列表</view>
  29. <scroll-view scroll-y="true" class="scrollY">
  30. <view class="cu-item" :class="index==selidx?'selected':''" @click="tosel(index,item)"
  31. v-for="(item,index) in customerlist" :key="index">{{item}}</view>
  32. </scroll-view>
  33. </view> -->
  34. <view class="middle-line-x"></view>
  35. <view class="cu-bar bg-white solid-bottom ">
  36. <view class="action">
  37. <text class="cuIcon-title text-orange "></text>{{customer.custname}}
  38. </view>
  39. </view>
  40. <view class="padding-lr">
  41. <view class="cu-form-group ">
  42. <view class="title">分类</view>
  43. <picker @change="photocalssChange" :value="class_index" :range="photocalsses">
  44. <view class="picker">
  45. {{photocalsses[class_index]}}
  46. </view>
  47. </picker>
  48. </view>
  49. <view class="cu-form-group ">
  50. <view class="title">标签</view>
  51. <picker @change="photolabelChange" :value="label_index" :range="photolabels">
  52. <view class="picker">
  53. {{photolabels[label_index]}}
  54. </view>
  55. </picker>
  56. </view>
  57. <view class="cu-form-group bord-b">
  58. <view class="title">备注</view>
  59. <input class="text-center" type="text" v-model="notes" placeholder="请输入备注"></input>
  60. </view>
  61. </view>
  62. <!-- <view class="flex-row">
  63. <text style="width: 120rpx; text-align: right; padding-right: 10rpx;">客户名:</text>
  64. <view>{{customer.custname}}</view>
  65. </view>
  66. <view class="flex-row infoitem">
  67. <text class="label">分类:</text>
  68. <picker style="width: 550rpx;" @change="photocalssChange" :value="class_index" :range="photocalsses">
  69. <view class="select-picker">
  70. <text class="placeholder"
  71. :class="photo_class === ''?'default':''">{{photocalsses[class_index]}}</text>
  72. <view class="select-picker-arrow-area">
  73. <view class="select-picker-arrow"></view>
  74. </view>
  75. </view>
  76. </picker>
  77. </view>
  78. <view class="flex-row infoitem">
  79. <text class="label">标签:</text>
  80. <picker style="width: 550rpx;" @change="photolabelChange" :value="label_index" :range="photolabels">
  81. <view class="select-picker">
  82. <text class="placeholder"
  83. :class="photo_label === ''?'default':''">{{photolabels[label_index]}}</text>
  84. <view class="select-picker-arrow-area">
  85. <view class="select-picker-arrow"></view>
  86. </view>
  87. </view>
  88. </picker>
  89. </view>
  90. <view class="flex-row infoitem">
  91. <text class="label">备注:</text>
  92. <view class="select-picker">
  93. <input type="text" v-model="notes" placeholder="请输入备注"
  94. style="width: 530rpx; background-color: #FFF;" />
  95. </view>
  96. </view> -->
  97. <!-- <view>
  98. <image @click="snap" mode="aspectFit" src='../../static/img/paizhao.png' class="snap-img"></image>
  99. </view> -->
  100. <!-- <view class="photos">
  101. <view class="container" v-for="(item,index) in 3" :key="index">
  102. <image :src="item.img" class="photo" @click="lookImg(index)"></image>
  103. <checkbox class="round red" :class="'item.selected'" @click="chg(item)" /></checkbox>
  104. </view>
  105. </view> -->
  106. <!-- <view class="cu-bar bg-white margin-top">
  107. <view class="action">
  108. 图片拍照上传
  109. </view>
  110. <view class="action">
  111. {{imgArr.length}}/4
  112. </view>
  113. </view> -->
  114. <view class="middle-line ">
  115. </view>
  116. <view class="cu-bar bg-white bord-b margin-b20">
  117. <view class="action">
  118. 选择全部图片
  119. </view>
  120. <view class="action" >
  121. <switch color="#068eee" style="transform:scale(0.9)" @change="selectAll" />
  122. </view>
  123. </view>
  124. <view class="cu-form-group ">
  125. <view class="grid col-3 grid-square flex-sub">
  126. <view class="bg-img" v-for="(item,index) in imgArr" :key="index" :data-url="imgArr[index].img">
  127. <image :src="imgArr[index].img" mode="aspectFill" @tap="ViewImage(index)"></image>
  128. <view class="cu-tag bg-red" :data-index="index">
  129. <!-- <checkbox class="round blue" @tap.stop="chg(item)" ></checkbox> -->
  130. <checkbox class="round blue" :class="item.selected?'checked':''" @tap="chg(item)">
  131. </checkbox>
  132. </view>
  133. </view>
  134. <view class="solids" @tap="snap()">
  135. <text class='cuIcon-cameraadd'></text>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="padding flex flex-direction">
  140. <!-- <button class="cu-btn round bg-yellow " @click="selectAll()">全选</button> -->
  141. <button class="cu-btn round bg-gradual-blue " @click="upload()">上传</button>
  142. <button class="cu-btn round bg-grey margin-tb-sm" @click="del()">删除</button>
  143. <!-- <view class="bg-green" @click="selectAll()">全选</view>
  144. <view class="bg-cyan" @click="del()">删除</view>
  145. <view class="bg-orange" @click="upload()">上传</view> -->
  146. </view>
  147. <!--因为要用到canvas,而项目中不能显示canvas,所以对它进行了隐藏-->
  148. <view style="width: 0; height: 0; overflow: hidden; visibility: hidden;">
  149. <canvas class='canvas' :style="{'width': canvasWdith+'px', 'height': canvasHeight+'px'}"
  150. canvas-id="firstCanvas"></canvas>
  151. </view>
  152. </view>
  153. </view>
  154. </template>
  155. <script>
  156. import moment from "moment";
  157. // #ifdef APP-PLUS
  158. import { openSqlite,executeSql,closedb,getTable,isTable,getAllField,insertAll,addSql,getPageList,selectList,deleteSql,updateSql,selectSql,batchUpdate} from "@/common/database.js";
  159. // #endif
  160. export default {
  161. data() {
  162. return {
  163. showunloadlist: false,
  164. customer: '',
  165. customerlist: [], //未上传的图片的客户队列
  166. selidx: 0,
  167. imgArr: [],
  168. //allimgArr: [],
  169. selectall: false,
  170. latitude: '23.123456',
  171. longitude: '113.123456',
  172. photocalsses: [],
  173. photolabels: [],
  174. class_index: 0,
  175. label_index: 0,
  176. notes: '',
  177. photo_label: '',
  178. photo_class: '',
  179. canvasWdith: 0,
  180. canvasHeight: 0,
  181. current: 0,
  182. //imgList:['https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg','https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg','https://ossweb-img.qq.com/images/lol/web201310/skin/big25002.jpg','https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg','https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg'],
  183. }
  184. },
  185. async onLoad(options) {
  186. //console.log('snap load',options)
  187. uni.hideLoading();
  188. var type = this.$store.state.optype
  189. console.log('snap load', type)
  190. if (type == 'un_upload') {
  191. var res = await this.getcustname()
  192. this.customerlist = res
  193. this.showunloadlist = true
  194. this.tosel(0, this.customerlist[0])
  195. console.log('加载获取',this.customerlist);
  196. } else {
  197. // this.customer = JSON.parse(options.customer)
  198. this.customer = this.$store.state.customer
  199. console.log('customer', this.customer);
  200. this.reloadimgarr(this.customer.custname)
  201. }
  202. // this.customer = JSON.parse(options.customer)
  203. console.log('客户信息',this.customer);
  204. },
  205. onShow() {
  206. var that = this
  207. var type = this.$store.state.optype
  208. if (type == 'view') {return} //看图后返回
  209. this.getPhotoClass()
  210. this.getLocation()
  211. },
  212. onHide: function() {
  213. console.log('snap Hide')
  214. uni.setStorage({
  215. key: 'unUploadimgs',
  216. data: this.imgArr,
  217. success() {
  218. console.log("存储成功unUploadimgs")
  219. }
  220. })
  221. },
  222. methods: {
  223. RadioChange(e) {
  224. console.log('radio',e.detail.value);
  225. },
  226. async reloadimgarr(custname){
  227. var res = await this.getunuploadbycust(custname)
  228. this.imgArr = []
  229. res.forEach(item =>{
  230. let it = {
  231. id:item.id,
  232. img:item.img,
  233. selected:false,
  234. custname:item.custname,
  235. customer:JSON.parse(item.customer)
  236. }
  237. this.imgArr.push(it)
  238. })
  239. },
  240. async getcustname(){
  241. var sql='select distinct custname from unupload'
  242. var ds = await selectSql(sql)
  243. var ret = []
  244. ds.forEach(item=>{
  245. ret.push(item.custname)
  246. })
  247. console.log(ret)
  248. return ret
  249. },
  250. async getcustomerinfo(custname){
  251. var sql='select distinct customer from unupload where custname="' + custname + '"'
  252. var ds = await selectSql(sql)
  253. console.log('数据库获取用户信息',ds[0].customer)//没有坐标信息 上传图片失败
  254. return ds[0].customer
  255. },
  256. async getunuploadbycust(custname){
  257. var sql='select * from unupload where custname="' + custname + '"'
  258. console.log(sql)
  259. var ds = await selectSql(sql)
  260. console.log(ds)
  261. return ds
  262. },
  263. async addunloadimg(item){
  264. var ret = await addSql("unupload",item)
  265. console.log(ret)
  266. this.reloadimgarr(item.custname)
  267. },
  268. async delunloadimg(item){
  269. console.log('exsql',item)
  270. var sql='delete from unupload where id=' +item.id
  271. var ret = await executeSql(sql)
  272. console.log(ret)
  273. },
  274. async tosel(e, cust) {
  275. console.log(e, cust)
  276. this.selidx = e
  277. var ct = await this.getcustomerinfo(cust)
  278. this.customer = JSON.parse(ct)
  279. this.reloadimgarr(cust)
  280. },
  281. getLocation() {
  282. var that = this
  283. uni.getLocation({
  284. type: 'gcj02',
  285. success: (res) => {
  286. console.log(res);
  287. that.latitude = res.latitude; //获取到的纬度
  288. that.longitude = res.longitude; //获取到的经度
  289. },
  290. fail: (res) => {
  291. uni.showToast({
  292. title: '获取位置信息失败',
  293. icon: 'none'
  294. })
  295. }
  296. })
  297. },
  298. watermark(tempfile) {
  299. var that = this
  300. uni.getImageInfo({
  301. src: tempfile,
  302. success: (ress) => {
  303. console.log('ress', ress);
  304. //console.log('res :',res.tempFilePaths[0]);
  305. let ctx = uni.createCanvasContext('firstCanvas'); /** 创建画布 */
  306. //that.w = ress.width/3 +'px';
  307. //that.h = ress.height/3+'px';
  308. let imgWidth = ress.width / 3;
  309. let imgHeight = ress.height / 3;
  310. that.canvasWdith = imgWidth;
  311. that.canvasHeight = imgHeight;
  312. that.$nextTick(() => {
  313. //将图片src放到cancas内,宽高为图片大小
  314. ctx.drawImage(tempfile, 0, 0, ress.width / 3, ress.height / 3)
  315. ctx.setFontSize(16)
  316. ctx.setFillStyle('#8a2929')
  317. //ctx.rotate(30 * Math.PI / 180);
  318. let textToWidth = 5;
  319. let textToHeight = ress.height / 3;
  320. let curdt = moment().format('llll');
  321. ctx.fillText('客户:' + that.customer.custname, textToWidth, textToHeight -
  322. 80)
  323. ctx.fillText(' 拍摄时间: ' + curdt, textToWidth, textToHeight - 55)
  324. ctx.fillText(' 拍摄人: ' + that.customer.saler, textToWidth, textToHeight -
  325. 30)
  326. ctx.fillText(' 地址:' + that.customer.addr, textToWidth, textToHeight - 5)
  327. console.log('ctx');
  328. uni.showLoading({
  329. title: '制作水印中...',
  330. })
  331. /** 除了上面的文字水印,这里也可以加入图片水印 */
  332. //ctx.drawImage('/static/watermark.png', 0, 0, ress.width / 3, ress.height / 3)
  333. ctx.draw(false, () => {
  334. setTimeout(() => {
  335. uni.canvasToTempFilePath({
  336. canvasId: 'firstCanvas',
  337. quality: 0.6,
  338. fileType: 'jpg',
  339. width: that.canvasWdith,
  340. height: that.canvasHeight,
  341. success: (
  342. res1) => {
  343. console.log('res1', res1);
  344. uni.hideLoading();
  345. uni.saveImageToPhotosAlbum({ //保存到手机
  346. filePath: res1
  347. .tempFilePath,
  348. success: (res) => {
  349. console.log('re',res);
  350. var imgulr = res.path
  351. console.log('imgulr',imgulr);
  352. var item = {
  353. selected:true,
  354. img: imgulr,
  355. custname: that.customer.custname,
  356. customer: JSON.stringify(that.customer)
  357. }
  358. that.addunloadimg(item)
  359. }
  360. })
  361. },
  362. fail(err) {
  363. console.log('canvas err:', err)
  364. uni.hideLoading();
  365. }
  366. });
  367. }, 500);
  368. });
  369. })
  370. }
  371. })
  372. },
  373. snap() {
  374. var that = this
  375. uni.chooseImage({
  376. count: 1,
  377. sizeType: ['original', 'compressed'],
  378. sourceType: ['camera'], //这要注意,camera掉拍照,album是打开手机相册
  379. success: (res) => {
  380. console.log(res);
  381. this.watermark(res.tempFilePaths[0])
  382. }
  383. });
  384. },
  385. async del() {
  386. var that = this
  387. let selnum = 0
  388. this.imgArr.forEach(item => {
  389. if(item.selected)
  390. selnum +=1
  391. });
  392. if(selnum == 0){
  393. uni.showToast({
  394. icon:'none',
  395. title:'您没有选择图片',
  396. duration:2000
  397. })
  398. return
  399. }
  400. uni.showModal({
  401. title: '图片删除',
  402. content: '确定要删除这张图片吗?',
  403. cancelText: '取消',
  404. confirmText: '确定',
  405. success: async res => {
  406. if (res.confirm) {
  407. var i = this.imgArr.length;
  408. while (i--) {
  409. var item = this.imgArr[i]
  410. if (item.selected) {
  411. var ret = await that.delLocalimg(item.img)
  412. console.log(ret)
  413. if(ret =='success' || ret=='noexist'){
  414. this.delunloadimg(item)
  415. that.imgArr.splice(i, 1);
  416. }
  417. }
  418. }
  419. }
  420. }
  421. })
  422. },
  423. async upload() {
  424. var that = this
  425. let selnum = 0
  426. this.imgArr.forEach(item => {
  427. if(item.selected)
  428. selnum +=1
  429. });
  430. if(selnum == 0){
  431. uni.showToast({
  432. icon:'none',
  433. title:'您没有选择图片',
  434. duration:2000
  435. })
  436. return
  437. }
  438. console.log('upload')
  439. var i = this.imgArr.length;
  440. while (i--) {
  441. var item = this.imgArr[i]
  442. if (item.selected) {
  443. let res = await this.loadLocalimg(item.img)
  444. if(res == 'error'){
  445. //加载图片出错
  446. this.delunloadimg(item)
  447. that.imgArr.splice(i, 1)
  448. continue
  449. }
  450. let filinfo = item.img.split('/')
  451. let filename = filinfo[filinfo.length - 1]
  452. console.log('filename', filename)
  453. let res2 = await this.uploadimg(filename, res)
  454. if (res2 == 'success') {
  455. this.delunloadimg(item)
  456. that.imgArr.splice(i, 1);
  457. uni.hideLoading()
  458. uni.showToast({
  459. title: '上传完成',
  460. icon:'success',
  461. duration:3000
  462. });
  463. }else {
  464. uni.hideLoading()
  465. uni.showToast({
  466. title: '上传失败',
  467. icon:'error',
  468. duration:3000
  469. });
  470. }
  471. }
  472. }
  473. },
  474. selectAll() {
  475. console.log('sel', this.selectall)
  476. var selectall = true
  477. this.imgArr.forEach(item => {
  478. if (!item.selected) {
  479. selectall = false
  480. }
  481. });
  482. //取反、
  483. selectall = !selectall
  484. this.imgArr.forEach(item => {
  485. item.selected = selectall
  486. });
  487. console.log('sel', this.imgArr)
  488. },
  489. chg(item, index) {
  490. console.log('item', item, index)
  491. this.currentPic = index
  492. item.selected = !item.selected
  493. },
  494. ViewImage(e) {
  495. console.log('view', e)
  496. this.$store.dispatch('SetOptype','view') //放大看图片
  497. var urls = []
  498. this.imgArr.forEach(item => {
  499. urls.push(item.img)
  500. })
  501. uni.previewImage({
  502. urls: urls,
  503. current: e
  504. });
  505. },
  506. delLocalimg(filename) {
  507. console.log(filename)
  508. const that = this;
  509. return new Promise((resolve, reject) => {
  510. plus.io.resolveLocalFileSystemURL(filename,function(entry) {
  511. console.log('FILE:',filename)
  512. entry.remove(function(file) {
  513. console.log("Remove succeeded");
  514. // console.log("that.imgArr.length", that.imgArr.length);
  515. resolve('success');
  516. },function(e){
  517. console.log('删除图片:', e)
  518. resolve('noexist')
  519. }
  520. );
  521. },
  522. function(e) {
  523. console.log('没有图片:', e)
  524. resolve('noexist')
  525. }
  526. );
  527. })
  528. },
  529. uploadimg(filename, imgdata) {
  530. // console.log('上传图片',filename, imgdata);
  531. return new Promise((resolve, reject) => {
  532. var that = this
  533. //return new Promise((resolve, reject) => {
  534. console.log('filename:', filename)
  535. //console.log('file:',evt.target.result)
  536. console.log('lat:', that.latitude)
  537. console.log('lng', that.longitude)
  538. var dis = that.distance(that.latitude, that.longitude, that.customer.lat, that.customer.lng);
  539. console.log('dis:', dis)
  540. var params = {
  541. class: "business_requ",
  542. eid: this.eid,
  543. data: {
  544. verno: "1.0",
  545. eid: this.eid,
  546. interface: "Customer/SignIn",
  547. userid: "",
  548. }
  549. }
  550. params.eid = getApp().globalData.eid
  551. params.data.eid = getApp().globalData.eid
  552. params.data.userid = getApp().globalData.userid
  553. params.data.custid = that.customer.custid
  554. params.data.branchid = that.customer.branchid
  555. params.data.saler = that.customer.saler
  556. params.data.lng = that.longitude
  557. params.data.lat = that.latitude
  558. params.data.custlng = that.customer.lng
  559. params.data.custlat = that.customer.lat
  560. params.data.far = Math.ceil(dis)?Math.ceil(dis):0
  561. params.data.fname = that.customer.custid + filename // file.name
  562. params.data.sdate = moment().format('YYYY-MM-DD')
  563. params.data.stype = that.photo_class
  564. params.data.label = that.photo_label
  565. params.data.notes = that.notes
  566. console.log('request.that.customer:', that.customer)
  567. console.log('request.param:', params)
  568. params.data.pic = imgdata
  569. uni.showLoading({
  570. title:'图片上传中....'
  571. })
  572. this.$webSockRe(params, 10000,false).then(ret => {
  573. console.log('图片上传回调',ret.data)
  574. if (ret.class == 'business_resp' && ret.data.data.Result == 1) {
  575. //console.log('success')
  576. resolve('success')
  577. } else {
  578. resolve('fail')
  579. }
  580. }).catch(err=>{
  581. console.error(err)
  582. resolve('fail')
  583. })
  584. })
  585. },
  586. loadLocalimg(filename) {
  587. console.log(filename)
  588. //var filepath = plus.io.convertLocalFileSystemURL(filename)
  589. //console.log(filepath)
  590. return new Promise((resolve, reject) => {
  591. const that = this;
  592. plus.io.resolveLocalFileSystemURL(
  593. filename,
  594. function(entry) {
  595. entry.file(function(file) {
  596. console.log('。。。。。')
  597. let reader = null;
  598. reader = new plus.io.FileReader();
  599. reader.onload = function(e) {};
  600. reader.readAsDataURL(file);
  601. reader.onloadend = function(e) {
  602. console.log('laod success')
  603. resolve(e.target.result)
  604. //let dataBase = e.target.result;
  605. };
  606. },
  607. function(e){
  608. console.log('打开图片出错:', e)
  609. resolve('error')
  610. });
  611. },
  612. function(e) {
  613. console.log('没有图片:', e)
  614. reject("error")
  615. }
  616. );
  617. })
  618. },
  619. distance(lat1, lng1, lat2, lng2) {
  620. var radLat1 = lat1 * Math.PI / 180.0;
  621. var radLat2 = lat2 * Math.PI / 180.0;
  622. var a = radLat1 - radLat2;
  623. var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
  624. var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
  625. Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
  626. s = s * 6378.137; // EARTH_RADIUS;
  627. s = Math.round(s * 10000) / 10;
  628. return s;
  629. },
  630. getPhotoClass() {
  631. var _this = this
  632. var params = {
  633. class: "business_requ",
  634. eid: this.eid,
  635. data: {
  636. verno: "1.0",
  637. eid: this.eid,
  638. interface: "SignRecord/getPhotoClass",
  639. pid: 5
  640. }
  641. }
  642. params.data.eid = getApp().globalData.eid
  643. params.eid = getApp().globalData.eid
  644. console.log('requ param :', params)
  645. this.$webSockRe(params, 5000).then(ret => {
  646. if (ret.class == 'business_resp') {
  647. console.log(ret);
  648. //var eid = ret.data.eid;
  649. let photocalsses = []
  650. ret.data.data.forEach(item => {
  651. photocalsses.push(item.pval)
  652. })
  653. _this.photocalsses = []
  654. _this.photocalsses = _this.photocalsses.concat(photocalsses)
  655. _this.photo_class = _this.photocalsses[0]
  656. //console.log('_this.photocalsses', _this.photocalsses);
  657. // console.log('getApp().globalData.eid',getApp().globalData.eid);
  658. _this.getPhotoLabel()
  659. }
  660. })
  661. },
  662. getPhotoLabel() {
  663. var _this = this
  664. var params = {
  665. class: "business_requ",
  666. eid: this.eid,
  667. data: {
  668. verno: "1.0",
  669. eid: this.eid,
  670. interface: "SignRecord/getPhotoLabel",
  671. pid: 6
  672. }
  673. }
  674. params.data.eid = getApp().globalData.eid
  675. params.eid = getApp().globalData.eid
  676. console.log('requ param :', params)
  677. this.$webSockRe(params, 5000).then(ret => {
  678. if (ret.class == 'business_resp') {
  679. let photolabels = []
  680. ret.data.data.forEach(item => {
  681. photolabels.push(item.pval)
  682. })
  683. _this.photolabels = []
  684. _this.photolabels = _this.photolabels.concat(photolabels)
  685. _this.photo_label = _this.photolabels[0]
  686. }
  687. })
  688. },
  689. photocalssChange: function(e) {
  690. console.log('picker发送选择改变,携带值为', e.target.value)
  691. this.class_index = e.target.value
  692. this.photo_class = this.photocalsses[this.class_index]
  693. },
  694. photolabelChange: function(e) {
  695. console.log('picker发送选择改变,携带值为', e.target.value)
  696. this.label_index = e.target.value
  697. this.photo_label = this.photolabels[this.label_index]
  698. },
  699. }
  700. }
  701. </script>
  702. <style>
  703. .selected {
  704. background-color: #CCCCCC;
  705. }
  706. .scrollY {
  707. height: 240rpx
  708. }
  709. .flex-row {
  710. display: flex;
  711. flex-direction: row;
  712. }
  713. .infoitem {
  714. margin: 20rpx 0;
  715. }
  716. .flex-1 {
  717. width: 170rpx;
  718. text-align: center;
  719. }
  720. .label {
  721. width: 120rpx;
  722. text-align: right;
  723. padding-right: 10rpx;
  724. height: 60rpx;
  725. line-height: 60rpx;
  726. }
  727. .cust_info {}
  728. .func_btn {
  729. flex: 1;
  730. margin: 6prx 10rpx;
  731. }
  732. .snap-img {
  733. width: 100rpx;
  734. height: 100rpx;
  735. }
  736. .photos {
  737. display: flex;
  738. flex-direction: row;
  739. flex-wrap: wrap;
  740. justify-content: space-around;
  741. align-items: flex-start;
  742. }
  743. .photo {
  744. height: 224rpx;
  745. width: 168rpx;
  746. margin: 4rpx 3rpx;
  747. }
  748. .container {
  749. position: relative;
  750. height: 232rpx;
  751. width: 174rpx;
  752. }
  753. .photosel {
  754. position: absolute;
  755. top: 10rpx;
  756. left: 100rpx;
  757. color: #000000;
  758. }
  759. .select-picker {
  760. /* #ifndef APP-NVUE */
  761. display: flex;
  762. /* #endif */
  763. flex-direction: row;
  764. align-items: center;
  765. flex-wrap: nowrap;
  766. font-size: 14px;
  767. line-height: 30px;
  768. padding: 0 4px;
  769. overflow: hidden;
  770. /* #ifdef APP-NVUE */
  771. height: 30px;
  772. /* #endif */
  773. border: 1px solid #e5e5e5;
  774. border-radius: 5px;
  775. text-indent: 4px;
  776. }
  777. .select-picker-arrow-area {
  778. position: relative;
  779. width: 20px;
  780. /* #ifndef APP-NVUE */
  781. margin-left: auto;
  782. display: flex;
  783. /* #endif */
  784. justify-content: center;
  785. transform: rotate(-45deg);
  786. transform-origin: center;
  787. }
  788. .select-picker-arrow {
  789. width: 7px;
  790. height: 7px;
  791. border-left: 1px solid #999;
  792. border-bottom: 1px solid #999
  793. }
  794. .placeholder.default {
  795. color: black;
  796. text-indent: 0px;
  797. }
  798. .select-pic {
  799. position: absolute;
  800. bottom: 0;
  801. right: 0;
  802. }
  803. .customer-list{
  804. width: 180rpx;
  805. height: 200rpx;
  806. }
  807. .customer-title{
  808. width: 180rpx;
  809. height: 200rpx;
  810. text-align: left;
  811. line-height: 40rpx;
  812. white-space: normal !important;
  813. display: flex;
  814. align-items: center;
  815. }
  816. .scroll-view_H {
  817. white-space: nowrap;
  818. width: 100%;
  819. height: 200rpx;
  820. }
  821. .at-item {
  822. animation-name: shutter-in-left;
  823. animation-duration: 1s;
  824. animation-timing-function: ease;
  825. animation-delay: 0s;
  826. animation-iteration-count: 1;
  827. animation-direction: normal;
  828. animation-fill-mode: none;
  829. }
  830. @keyframes shutter-in-left {
  831. 0%{
  832. -webkit-transform: rotateY(100deg);
  833. transform: rotateY(100deg);
  834. -webkit-transform-origin: left;
  835. transform-origin: left;
  836. opacity: 0;
  837. }
  838. 100%{
  839. -webkit-transform: rotateY(0);
  840. transform: rotateY(0);
  841. -webkit-transform-origin: left;
  842. transform-origin: left;
  843. opacity: 1;
  844. }
  845. }
  846. </style>