sample-collection-detail.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  1. <template>
  2. <view style="height: 100vh;">
  3. <uni-nav-bar v-if="!isUploaded" dark :fixed="true" :border="false" background-color="#253a6f" status-bar
  4. left-icon="left" left-text="完成" title="样品采集" @clickLeft="goBack" />
  5. <uni-nav-bar v-if="isUploaded" dark :fixed="true" :border="false" background-color="#253a6f" status-bar
  6. left-icon="left" left-text="返回" title="样品采集" @clickLeft="goBack" />
  7. <view class="container" :style="{'height': clientHeight + 'px'}">
  8. <view class="header">
  9. <view class="segmented-control-item" :class="{ 'active': activeTab === 0 }" @click="switchTab(0)">接待信息
  10. <view class="underline" v-show="activeTab === 0"></view>
  11. </view>
  12. <view class="segmented-control-item" :class="{ 'active': activeTab === 1 }" @click="switchTab(1)">选样扫描
  13. <view class="underline" v-show="activeTab === 1"></view>
  14. </view>
  15. <view class="segmented-control-item" :class="{ 'active': activeTab === 2 }" @click="switchTab(2)">选样列表
  16. <view class="underline" v-show="activeTab === 2"></view>
  17. </view>
  18. </view>
  19. <!-- <view class="absolute-element"> -->
  20. <!-- <scroll-view class="scroll-view" scroll-y="true"> -->
  21. <swiper class="scroll-view swiper" style="height: 100%;" :current="activeTab" duration="0"
  22. @change="handleSwiperChange">
  23. <swiper-item>
  24. <!-- 根据 activeTab 显示不同的页面 -->
  25. <!-- <view v-if="activeTab === 0"> -->
  26. <!-- <scroll-view scroll-y="true" style="height: 100%;"> -->
  27. <scroll-view scroll-y="true" :style="{'height': clientHeight + 'px'}">
  28. <view class="content" v-if="activeTab === 0">
  29. <view class="content1">
  30. <u--form labelPosition="left" :model="baseData" ref="uForm" labelWidth='40'
  31. :rules="rules" :errorType="errorType">
  32. <u-form-item left-icon="../../static/meeting.png"
  33. leftIconStyle="width:60rpx;height:60rpx" prop="exhibitionName" borderBottom
  34. @click="">
  35. <u--input v-model.trim="baseData.exhibitionName" placeholder="请输入展会名称"
  36. border="none"></u--input>
  37. </u-form-item><u-form-item left-icon="../../static/customer.png"
  38. leftIconStyle="width:60rpx;height:60rpx" prop="customerName" borderBottom
  39. @click="">
  40. <u--input v-model.trim="baseData.customerName" placeholder="请输入客户名称"
  41. border="none"></u--input>
  42. </u-form-item><u-form-item left-icon="../../static/receiver.png"
  43. leftIconStyle="width:60rpx;height:60rpx" prop="receiver" borderBottom @click="">
  44. <u--input v-model.trim="baseData.receiver" placeholder="请输入接待人姓名"
  45. border="none"></u--input>
  46. </u-form-item><u-form-item prop="exhibitionNote" borderBottom @click="">
  47. <!-- <uni-easyinput type="textarea" v-model="baseData.exhibitionNote" placeholder="展会备注信息" /> -->
  48. <u--textarea confirmType="null" v-model="baseData.exhibitionNote"
  49. placeholder="展会备注信息"></u--textarea>
  50. </u-form-item>
  51. <uni-section required>
  52. <uni-file-picker :value="baseData.fileSavePath"
  53. :source-type="['album', 'camera']" @select="handleFileSelect"
  54. @delete="handleDelete" ref="filePicker" :image-styles="imageStyles">
  55. <view style="color: #c0c4cc ;font-size: 15px;">上传图片</view>
  56. </uni-file-picker>
  57. </uni-section>
  58. <u-button v-if="!isUploaded" style="margin-top: 5px;" @click="handleSave"
  59. type="primary" color="#253a6f" text="保存接待信息"></u-button>
  60. </u--form>
  61. </view>
  62. </view>
  63. </scroll-view>
  64. </swiper-item>
  65. <swiper-item style="height: 100%;">
  66. <!-- <scroll-view scroll-y="true" style="height: 100%;"> -->
  67. <scroll-view scroll-y="true" style="height: 100%;">
  68. <view class="content" v-if="activeTab === 1">
  69. <view class="content1">
  70. <u--form labelPosition="left" :model="detailData" ref="uForm1" labelWidth='40'
  71. :rules="rules2" :errorType="errorType">
  72. <u-form-item left-icon="../../static/customer.png"
  73. leftIconStyle="width:60rpx;height:60rpx" prop="" borderBottom @click="">
  74. <u--input readonly v-model.trim="baseData.customerName" placeholder=""
  75. border="none"></u--input>
  76. </u-form-item>
  77. <u-form-item left-icon="../../static/code.png"
  78. leftIconStyle="width:60rpx;height:60rpx" prop="barCode" borderBottom>
  79. <u--input type="text" v-model.trim="detailData.barCode" @confirm="getScanValue"
  80. :focus="focus" placeholder="样品条码序列号" border="none"></u--input>
  81. <u-button slot="right" type="primary" hairline size="small"
  82. url="/pages/scan/scanView" @click="goScan()"
  83. v-if="!isUploaded">扫描条码</u-button>
  84. <!-- <u-button slot="right" type="primary" hairline size="small" v-if="!isUploaded"> -->
  85. <!-- <navigator url="/pages/collections/scanView">扫描条码</navigator> -->
  86. <!-- </u-button> -->
  87. </u-form-item>
  88. <u-form-item left-icon="../../static/bs.png"
  89. leftIconStyle="width:60rpx;height:60rpx" prop="bpQuantity" borderBottom>
  90. <u--input type="number" v-model.trim="detailData.bpQuantity"
  91. placeholder="布片数量(默认为1)" border="none"></u--input>
  92. </u-form-item><u-form-item left-icon="../../static/gs.png"
  93. leftIconStyle="width:60rpx;height:60rpx" prop="gyQuantity" borderBottom>
  94. <u--input type="number" v-model.trim="detailData.gyQuantity"
  95. placeholder="挂样数量(默认为0)" border="none"></u--input>
  96. </u-form-item><u-form-item left-icon="../../static/ms.png"
  97. leftIconStyle="width:60rpx;height:60rpx" prop="myQuantity" borderBottom>
  98. <u--input type="number" v-model.trim="detailData.myQuantity"
  99. placeholder="米样数量(默认为0)" border="none"></u--input>
  100. </u-form-item><u-form-item borderBottom>
  101. <u--textarea autoHeight confirmType="null" v-model="detailData.note"
  102. placeholder="样品备注信息"></u--textarea>
  103. </u-form-item>
  104. <uni-section>
  105. <view style="padding-top: 0;">
  106. <uni-file-picker v-model="detailData.fileSavePath"
  107. :source-type="['album', 'camera']" :image-styles="imageStyles"
  108. @select="handleDetailFileSelect" @delete="handleDetailFileDelete"
  109. ref="filePicker">
  110. <view style="color: #c0c4cc ;font-size: 15px;">上传图片</view>
  111. </uni-file-picker>
  112. </view>
  113. </uni-section>
  114. <u-button @click="handleSaveDetail" style="margin-top: 5px;" type="primary"
  115. color="#253a6f" text="保存选样" v-if="!isUploaded"></u-button>
  116. </u--form>
  117. </view>
  118. </view>
  119. </scroll-view>
  120. </swiper-item>
  121. <swiper-item>
  122. <!-- <scroll-view scroll-y="true" style="height: 100%;"> -->
  123. <scroll-view scroll-y="true" :style="{'height': clientHeight + 'px'}">
  124. <view class="content" v-if="activeTab === 2">
  125. <view class="content2">
  126. <view class="list" v-for="(item, index) in detailList" :key="index">
  127. <view class="list-item">
  128. <view style="padding-top: 5px;">
  129. <checkbox-group @change="toggleSelect(index)">
  130. <checkbox
  131. style="transform: scale(0.6,0.6);activeBackgroundColor: #253a6f;iconColor: #253a6f;"
  132. v-model="selected[index]" :checked="selected[index]"
  133. :key="item.id" />
  134. </checkbox-group>
  135. </view>
  136. <view>
  137. <view class="item" @click="goDetailPage(item.id)">
  138. <text style="color: #949494;">序号:{{detailList.length-index}}</text>
  139. </view>
  140. <view class="item" @click="goDetailPage(item.id)">
  141. <image class="icon" src="/static/barcode.png" />
  142. <text
  143. style="color: #949494;margin-top: 3px;margin-left: 10px;">{{ item.barCode }}</text>
  144. </view>
  145. <view style="display: flex;margin-top: 20rpx;"
  146. @click="goDetailPage(item.id)">
  147. <view class="box" style="background-color: #F29047;">
  148. <text class="text">布样:{{item.bpQuantity}}</text>
  149. </view>
  150. <view class="gap"></view>
  151. <view class="box" style="background-color: #3AA693;">
  152. <text class="text">挂样:{{ item.gyQuantity }}</text>
  153. </view>
  154. <view class="gap"></view>
  155. <view class="box" style="background-color: #3855A4;">
  156. <text class="text">米样:{{ item.myQuantity }}</text>
  157. </view>
  158. </view>
  159. <view class="item"
  160. :style="{ 'flex-wrap': item.fileSavePath.length <= 2 ? 'nowrap' : 'wrap' }">
  161. <u--image class="image-item" v-for="(element, i) in item.fileSavePath"
  162. :key="i" :src="element" width="80px" height="80px"
  163. @click="previewImage(item,i)"></u--image>
  164. </view>
  165. <text class="item" style="color: #949494;">备注信息:{{ item.note }}</text>
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </scroll-view>
  172. </swiper-item>
  173. </swiper>
  174. <!-- </scroll-view> -->
  175. <view class="bottom-bar" v-show="activeTab === 2" v-if="!isUploaded">
  176. <view style="display: flex; width: 90%;margin: 0 auto;align-items:center">
  177. <!-- <checkbox-group style="margin-left: 20px;">
  178. <view style="width: 300rpx;">
  179. <checkbox-group @change="toggleSelectAll">
  180. <checkbox :value="selectAll" :checked="selectAll"
  181. style="transform: scale(0.6,0.6);activeBackgroundColor: #253a6f;iconColor: #253a6f;" />
  182. 全选 已选{{selectedCount}}项
  183. </checkbox-group>
  184. </view>
  185. </checkbox-group> -->
  186. <checkbox-group style="margin-left: 10px;" @change="toggleSelectAll">
  187. <view style="width: 300rpx;">
  188. <checkbox :value="selectAll" :checked="selectAll"
  189. style="transform: scale(0.5,0.5);activeBackgroundColor: #253a6f;iconColor: #253a6f;" />
  190. 全选 已选{{selectedCount}}项
  191. </view>
  192. </checkbox-group>
  193. <!-- <view style="display: flex;margin-left:70px;align-items: center;"> -->
  194. <view style="margin-right: 10px;">
  195. <button type="default"
  196. style="color:#ffffff;backgroundColor:#6DFBDB; border-radius: 50px;width:150rpx; height:65rpx;font-size: unset;visibility: hidden;">删除</button>
  197. </view>
  198. <view>
  199. <button
  200. style="color:#ffffff;backgroundColor:#6DFBDB; border-radius: 50px;width:150rpx; height:65rpx;font-size: unset;display: flex;justify-content: center; align-items:center"
  201. @click="changeListData">删除</button>
  202. </view>
  203. <!-- </view> -->
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. </template>
  209. <script>
  210. import {
  211. openSqlite,
  212. executeSql,
  213. closedb,
  214. getTable,
  215. isTable,
  216. getAllField,
  217. insertAll,
  218. addSql,
  219. getPageList,
  220. selectList,
  221. deleteSql,
  222. updateSql,
  223. selectSql,
  224. batchUpdate
  225. } from "@/utils/database";
  226. const scanner = uni.requireNativePlugin('Ba-Scanner');
  227. export default {
  228. data() {
  229. return {
  230. tableName: "public",
  231. baseData: {
  232. exhibitionName: '',
  233. customerName: '',
  234. receiver: '',
  235. exhibitionNote: "",
  236. fileList: [],
  237. },
  238. initbaseData: {},
  239. detailData: {
  240. barCode: '',
  241. bpQuantity: '',
  242. gyQuantity: '',
  243. myQuantity: '',
  244. note: "",
  245. fileSavePath: [],
  246. },
  247. clientHeight: '',
  248. isUploaded: false,
  249. detailList: [],
  250. errorType: 'toast',
  251. rules: {
  252. exhibitionName: [{
  253. required: true,
  254. message: '请输入展会名称',
  255. }],
  256. customerName: [{
  257. required: true,
  258. message: '请输入客户名称',
  259. }],
  260. receiver: [{
  261. required: true,
  262. message: '请输入接待人姓名',
  263. }]
  264. },
  265. rules2: {
  266. barCode: [{
  267. required: true,
  268. message: '条形码不能为空',
  269. }],
  270. bpQuantity: [{
  271. type: 'number',
  272. max: 5,
  273. message: '布片数量过大',
  274. },
  275. {
  276. validator: this.validateDecimal,
  277. trigger: 'blur'
  278. }
  279. ],
  280. gyQuantity: [{
  281. type: 'number',
  282. max: 5,
  283. message: '挂样数量过大',
  284. },
  285. {
  286. validator: this.validateDecimal,
  287. trigger: 'blur'
  288. }
  289. ],
  290. myQuantity: [{
  291. type: 'number',
  292. max: 5,
  293. message: '米样数量过大',
  294. },
  295. {
  296. validator: this.validateDecimal,
  297. trigger: 'blur'
  298. }
  299. ]
  300. // barCode: [{
  301. // required: true,
  302. // message: '条形码不能为空',
  303. // }],
  304. // barCode: [{
  305. // required: true,
  306. // message: '条形码不能为空',
  307. // }]
  308. },
  309. imageStyles: {
  310. border: {
  311. color: "#dadbde",
  312. width: 1,
  313. style: '',
  314. radius: '2px'
  315. }
  316. },
  317. focus: true,
  318. selected: [], // 保存每个数据项是否被选中的状态
  319. selectAll: false, // 全选状态
  320. selectedCount: 0,
  321. activeTab: 0, // 当前选中的页面索引
  322. imageUrl: 'file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/doc/uniapp_save/17049440506630.jpg',
  323. fileSavePath: []
  324. };
  325. },
  326. async onShow() {
  327. /**
  328. * 数据库设置名称 在 database.js 文件中
  329. */
  330. // console.log("所有表名称",await getTable())
  331. // 默认打开数据库,并创建表
  332. await this.openSqlite()
  333. await this.createTable()
  334. await this.createDetailTable()
  335. const res = uni.getSystemInfo({
  336. success: (res => {
  337. console.log(res.windowHeight)
  338. if (res.windowHeight < 600) {
  339. this.clientHeight = 520
  340. } else {
  341. this.clientHeight = res.windowHeight - 150;
  342. }
  343. console.log(res.windowHeight)
  344. // console.log(getApp().globalData.navHeight)
  345. })
  346. });
  347. console.log(this.clientHeight)
  348. // plus.key.hideSoftKeybord();
  349. },
  350. mounted() {
  351. this.selected = new Array(this.detailData.length).fill(false)
  352. },
  353. watch: {
  354. selected: {
  355. handler() {
  356. this.selectedCount = this.selected.filter(value => value === true).length;
  357. },
  358. deep: true,
  359. },
  360. },
  361. computed: {
  362. },
  363. //获取上一页传过来的参数
  364. onLoad(option) {
  365. plus.key.hideSoftKeybord();
  366. uni.$on('data', (data) => {
  367. console.log(data); // 输出 { name: 'John', age: 25 }
  368. this.detailData.barCode = data
  369. this.pointblur()
  370. plus.key.hideSoftKeybord();
  371. })
  372. uni.$on('data1', (data) => {
  373. console.log(data)
  374. this.getData(data)
  375. this.switchTab(2)
  376. })
  377. // 监听自定义事件 receiveData
  378. uni.$on('receiveData', (data) => {
  379. console.log(data)
  380. this.getData(data)
  381. this.pointblur()
  382. plus.key.hideSoftKeybord();
  383. });
  384. // if (option.hasOwnProperty('barCode')) {
  385. // this.detailData.barCode = option.barCode
  386. // this.switchTab(1)
  387. // return
  388. // }
  389. if (option.hasOwnProperty('uid')) {
  390. this.getData(option.uid)
  391. this.switchTab(1)
  392. return
  393. } else {
  394. this.switchTab(2)
  395. }
  396. // console.log(option)
  397. // console.log(option.uid)
  398. // this.getData(option.uid)
  399. // uni.hideKeyboard();
  400. // this.initbaseData = this.baseData
  401. // console.log(this.baseData)
  402. // this.baseData = JSON.parse(decodeURIComponent(option.data));
  403. // console.log(this.baseData.fileList)
  404. },
  405. methods: {
  406. // 自定义校验函数,验证小数点位数
  407. validateDecimal(rule, value, callback) {
  408. console.log(value)
  409. if (value) {
  410. // 小数点位数不超过两位
  411. if (!/^\d+(\.\d{1,2})?$/.test(value)) {
  412. return callback(new Error('小数点后不能超过两位'));
  413. }
  414. callback();
  415. }
  416. },
  417. handleSwiperChange(event) {
  418. console.log(event.detail.current)
  419. this.activeTab = event.detail.current;
  420. if (event.detail.current == 1) {
  421. console.log(event.detail.current)
  422. setTimeout(() => {
  423. console.log('隐藏')
  424. plus.key.hideSoftKeybord();
  425. // uni.hideKeyboard()
  426. }, 700)
  427. }
  428. },
  429. goBack() {
  430. if (this.isUploaded) {
  431. uni.$emit('refreshData');
  432. uni.navigateBack({
  433. delta: 1, // 返回上一层页面
  434. success() {
  435. console.log('返回上一页成功');
  436. },
  437. fail(err) {
  438. console.error('返回上一页失败', err);
  439. }
  440. });
  441. return
  442. }
  443. let self = this
  444. console.log(self.baseData)
  445. console.log(self.initbaseData)
  446. console.log(this.compareObjects(self.baseData, self.initbaseData))
  447. if (!this.compareObjects(self.baseData, self.initbaseData)) {
  448. uni.showModal({
  449. // title: '提示',
  450. content: '您有接待信息尚未保存,确定要退出吗?',
  451. confirmText: '保存并退出',
  452. success: async function(res) {
  453. if (res.confirm) {
  454. console.log('用户点击确定')
  455. // self.handleSaveNoValidate()
  456. const urls = self.baseData.fileSavePath.map(item => item.url);
  457. const fileSavePath = urls.join(',');
  458. try {
  459. await updateSql('public', {
  460. exhibitionName: self.baseData.exhibitionName,
  461. customerName: self.baseData.customerName,
  462. receiver: self.baseData.receiver,
  463. exhibitionNote: self.baseData.exhibitionNote,
  464. fileSavePath: fileSavePath
  465. }, {
  466. uid: self.baseData.uid
  467. })
  468. } catch (e) {
  469. uni.showToast({
  470. title: "修改报错,请查看控制台",
  471. icon: "none"
  472. });
  473. console.error("修改报错", e)
  474. }
  475. uni.$emit('refreshData');
  476. uni.navigateBack({
  477. delta: 1, // 返回上一层页面
  478. success() {
  479. console.log('返回上一页成功');
  480. let page = getCurrentPages().pop();
  481. if (page) {
  482. page.onLoad(page.options); //执行上个页面的方法
  483. };
  484. },
  485. fail(err) {
  486. console.error('返回上一页失败', err);
  487. }
  488. });
  489. } else if (res.cancel) {
  490. console.log('用户点击取消')
  491. }
  492. }
  493. })
  494. } else {
  495. uni.showModal({
  496. // title: '提示',
  497. content: '确认选样完结?',
  498. success: function(res) {
  499. if (res.confirm) {
  500. console.log('用户点击确定')
  501. uni.$emit('refreshData');
  502. uni.navigateBack({
  503. delta: 1, // 返回上一层页面
  504. success() {
  505. console.log('返回上一页成功');
  506. },
  507. fail(err) {
  508. console.error('返回上一页失败', err);
  509. }
  510. });
  511. } else if (res.cancel) {
  512. console.log('用户点击取消')
  513. }
  514. }
  515. })
  516. }
  517. },
  518. onBackPress(e) {
  519. console.log("监听返回按钮事件", e);
  520. if (e.from == "backbutton") {
  521. this.goBack()
  522. return true
  523. }
  524. },
  525. async getData(uid) {
  526. try {
  527. let where = {
  528. "uid": uid,
  529. }
  530. let detailwhere = {
  531. "publicId": uid,
  532. 'deleted': 0
  533. }
  534. let res = await selectList(this.tableName, where)
  535. let res2 = await selectList('detail', detailwhere, "createTime desc")
  536. console.log("加载数据", res)
  537. res.forEach(item => {
  538. if (item.fileSavePath === "") {
  539. item.fileSavePath = []; // 如果为空字符串,则设置为空数组
  540. } else {
  541. // 将 fileSavePath 字符串转换为数组
  542. const files = item.fileSavePath.split(',');
  543. // 使用 map() 方法将每个文件路径转换为对象
  544. item.fileSavePath = files.map(file => {
  545. const fileName = file.split('/').pop(); // 提取文件名
  546. const extname = fileName.split('.').pop(); // 提取扩展名
  547. return {
  548. name: fileName,
  549. extname: extname,
  550. url: file,
  551. path: file
  552. };
  553. });
  554. }
  555. });
  556. const detailRes = res2.map(({
  557. fileSavePath,
  558. ...rest
  559. }) => ({
  560. fileSavePath: fileSavePath ? fileSavePath.split(',') : [],
  561. ...rest
  562. }));
  563. // console.log(result[0]);
  564. this.baseData = res[0]
  565. if (res[0].uploaded == 1) {
  566. this.isUploaded = true
  567. }
  568. this.initbaseData = {
  569. ...res[0]
  570. };
  571. this.detailList = detailRes
  572. console.log(this.baseData)
  573. console.log(this.detailList)
  574. // this.total = res.data.data.total
  575. } catch (e) {
  576. uni.showToast({
  577. title: "报错,请查看控制台",
  578. icon: "none"
  579. });
  580. console.error("报错", e)
  581. }
  582. },
  583. getDetailData(id) {
  584. try {
  585. let where = {
  586. "id": id,
  587. 'deleted': 0
  588. }
  589. let res = selectList('detail', where)
  590. return res
  591. // console.log("加载数据", res)
  592. // const result = res.map(({
  593. // fileSavePath,
  594. // ...rest
  595. // }) => ({
  596. // fileSavePath: fileSavePath ? fileSavePath.split(',') : [],
  597. // ...rest
  598. // }));
  599. // console.log(result[0]);
  600. // this.detailData = result[0]
  601. } catch (e) {
  602. uni.showToast({
  603. title: "报错,请查看控制台",
  604. icon: "none"
  605. });
  606. console.error("报错", e)
  607. }
  608. },
  609. getScanValue(event) {
  610. if (this.isUploaded) { //已上传不执行代码
  611. return;
  612. }
  613. // console.log(event)
  614. setTimeout(() => {
  615. console.log(this.detailData.barCode)
  616. // console.log("event", event)
  617. // this.detailData.barCode = event
  618. this.handleSaveDetail1()
  619. // plus.key.hideSoftKeybord()
  620. }, 400)
  621. // this.handleSaveDetail()
  622. // this.pointblur();
  623. // console.log('hahahha')
  624. },
  625. pointblur() {
  626. this.focus = false
  627. this.$nextTick(() => {
  628. this.focus = true
  629. })
  630. },
  631. onmarked(type, result) {
  632. var text = '未知: ';
  633. switch (type) {
  634. case plus.barcode.QR:
  635. text = 'QR: ';
  636. break;
  637. case plus.barcode.EAN13:
  638. text = 'EAN13: ';
  639. break;
  640. case plus.barcode.EAN8:
  641. text = 'EAN8: ';
  642. break;
  643. }
  644. return text + result;
  645. },
  646. onScan() { //单次,默认界面
  647. console.log('onScan')
  648. let that = this;
  649. scanner.onScan({
  650. // barcodeFormats: ["QR Code", "Code 128"],
  651. // isShowVibrate: true,
  652. // isShowBeep: true,
  653. hintText: '单次扫码',
  654. },
  655. (ret) => {
  656. console.log(ret)
  657. if (ret.result) {
  658. that.resultList.push(ret.result);
  659. that.showToast(ret.result);
  660. }
  661. });
  662. },
  663. goScan() {
  664. let params = this.detailData
  665. params.publicId = this.baseData.uid
  666. console.log('onScan')
  667. uni.navigateTo({
  668. url: '/pages/collections/scanView?params=' +
  669. JSON.stringify(params)
  670. });
  671. // url: '/pages/automatedwarehouse/index?formData=' + encodeURIComponent(JSON.stringify(this.formData)),
  672. //扫描设备二维码
  673. // scan() {
  674. // const currentWebview = this.$mp.page.$getAppWebview();
  675. // var barcode = plus.barcode.create('barcode', [plus.barcode.CODE128], {
  676. // top: '100px',
  677. // left: '0px',
  678. // width: '300px',
  679. // height: '300px',
  680. // position: 'static'
  681. // });
  682. //此处未演示扫码成功回调的地址设置,实际请参考HTML5Plus API自行处理
  683. //注意扫码区域需为正方形,否则影响扫码识别率
  684. // currentWebview.append(barcode);
  685. // barcode.start();
  686. // barcode.onmarked = function(type, code, file) {
  687. // // 在这里处理扫码成功后的逻辑
  688. // console.log('扫码成功,类型:', type);
  689. // console.log('扫描结果:', code);
  690. // console.log('文件路径:', file);
  691. // // 示例:展示扫描结果
  692. // alert('扫描成功\n类型:' + type + '\n结果:' + code);
  693. // };
  694. // uni.scanCode({
  695. // scanType: ['CODE_128'],
  696. // success: qrcode => {
  697. // let scanRedult = qrcode.result
  698. // this.detailData.barCode = scanRedult
  699. // }
  700. // })
  701. },
  702. handleFileSelect(e) {
  703. console.log(this.baseData)
  704. const self = this
  705. this.handleSaveImages(e) //上传图片
  706. .then(e => {
  707. // console.log('returneeeee', e);
  708. console.log(self.baseData)
  709. // console.log('fileSavePath', self.baseData.fileSavePath);
  710. self.baseData.fileSavePath = self.baseData.fileSavePath.concat(e.tempFiles)
  711. console.log(self.baseData)
  712. })
  713. },
  714. handleDetailFileSelect(e) {
  715. console.log(e.tempFiles)
  716. const self = this
  717. this.handleSaveImages(e) //上传图片
  718. .then(e => {
  719. // console.log('returneeeee', e);
  720. self.detailData.fileSavePath = self.detailData.fileSavePath.concat(e.tempFiles)
  721. // console.log('fileSavePath', self.detailData.fileSavePath)
  722. })
  723. },
  724. async handleSaveImages(e) {
  725. console.log('eeee', e)
  726. for (const item of e.tempFiles) {
  727. console.log('bbbb', item)
  728. try {
  729. const trueurl = await this.saveImage(item.path);
  730. item.url = trueurl;
  731. console.log('item', item)
  732. } catch (error) {
  733. console.error(`Failed to convert image to Base64:`, error);
  734. }
  735. }
  736. return e
  737. },
  738. // 定义一个异步函数上传图片
  739. async saveImage(filePath) {
  740. console.log(filePath)
  741. return new Promise((resolve, reject) => {
  742. uni.saveFile({
  743. tempFilePath: filePath,
  744. success: res => {
  745. console.log('文件保存成功', res);
  746. resolve(res.savedFilePath);
  747. },
  748. fail: err => reject(err)
  749. })
  750. });
  751. },
  752. handleDelete(e) {
  753. console.log(e)
  754. // uni.removeSavedFile({
  755. // filePath: res.fileList[0].filePath,
  756. // complete: function(res) {
  757. // console.log(res);
  758. // }
  759. // });
  760. this.baseData.fileSavePath = this.baseData.fileSavePath.filter(item => item !== e.tempFile)
  761. },
  762. handleDetailFileDelete(e) {
  763. // console.log(e)
  764. // uni.removeSavedFile({
  765. // filePath: res.fileList[0].filePath,
  766. // complete: function(res) {
  767. // console.log(res);
  768. // }
  769. // });
  770. this.detailData.fileSavePath = this.detailData.fileSavePath.filter(item => item !== e
  771. .tempFile)
  772. },
  773. handleSave() {
  774. this.$refs['uForm'].validate().then(async () => {
  775. // console.log(this.baseData)
  776. const urls = this.baseData.fileSavePath.map(item => item.url);
  777. const fileSavePath = urls.join(',');
  778. // console.log(fileSavePath);
  779. // const fileSavePath = this.baseData.fileSavePath.join(',');
  780. // console.log(fileSavePath);
  781. try {
  782. await updateSql(this.tableName, {
  783. exhibitionName: this.baseData.exhibitionName,
  784. customerName: this.baseData.customerName,
  785. receiver: this.baseData.receiver,
  786. exhibitionNote: this.baseData.exhibitionNote,
  787. fileSavePath: fileSavePath
  788. }, {
  789. uid: this.baseData.uid
  790. })
  791. const self = this
  792. uni.showToast({
  793. title: "接待信息保存成功",
  794. icon: "none",
  795. success: function() {
  796. self.detailData.customerName = self.baseData
  797. .customerName
  798. self.initbaseData = self.baseData
  799. // showToast 弹窗关闭后执行跳转
  800. self.switchTab(1)
  801. }
  802. });
  803. } catch (e) {
  804. uni.showToast({
  805. title: "修改报错,请查看控制台",
  806. icon: "none"
  807. });
  808. console.error("修改报错", e)
  809. }
  810. }).catch(errors => {
  811. console.log(errors)
  812. uni.$u.toast(errors[0].message)
  813. })
  814. },
  815. handleSaveNoValidate() {
  816. self.$refs['uForm'].validate().then(async () => {
  817. const urls = self.baseData.fileSavePath.map(item => item.url);
  818. const fileSavePath = urls.join(',');
  819. try {
  820. await updateSql(self.tableName, {
  821. exhibitionName: self.baseData.exhibitionName,
  822. customerName: self.baseData.customerName,
  823. receiver: self.baseData.receiver,
  824. exhibitionNote: self.baseData.exhibitionNote,
  825. fileSavePath: fileSavePath
  826. }, {
  827. uid: self.baseData.uid
  828. })
  829. const self = self
  830. uni.showToast({
  831. title: "接待信息保存成功",
  832. icon: "none",
  833. success: function() {
  834. self.detailData.customerName = self.baseData
  835. .customerName
  836. // showToast 弹窗关闭后执行跳转
  837. self.switchTab(1)
  838. }
  839. });
  840. } catch (e) {
  841. uni.showToast({
  842. title: "修改报错,请查看控制台",
  843. icon: "none"
  844. });
  845. console.error("修改报错", e)
  846. }
  847. }).catch(errors => {
  848. console.log(errors)
  849. uni.$u.toast(errors[0].message)
  850. })
  851. },
  852. async handleSaveDetail1() {
  853. this.$refs['uForm1'].validate().then(async () => {
  854. console.log('aaaaa', this.detailData.fileSavePath)
  855. // 使用 map 方法提取需要的属性值
  856. const urls = this.detailData.fileSavePath.map(item => item.url);
  857. console.log(urls)
  858. // 使用 join 方法将剩余元素以逗号拼接为字符串
  859. const fileSavePath = urls.join(',');
  860. console.log(fileSavePath); // 输出 "Alice, Charlie"
  861. try {
  862. // detailData: {
  863. // barCode: '',
  864. // bpQuantity: '',
  865. // gyQuantity: '',
  866. // myQuantity: '',
  867. // note: "",
  868. // fileList: [],
  869. // },
  870. let b = await addSql('detail', {
  871. publicId: this.baseData.uid,
  872. barCode: this.detailData.barCode,
  873. bpQuantity: this.detailData.bpQuantity || 1,
  874. gyQuantity: this.detailData.gyQuantity || 0,
  875. myQuantity: this.detailData.myQuantity || 0,
  876. note: this.detailData.note,
  877. fileSavePath: fileSavePath
  878. })
  879. const self = this
  880. uni.showToast({
  881. title: "添加成功",
  882. icon: "none",
  883. duration: 1000,
  884. success: function() {
  885. self.getData(self.baseData.uid)
  886. self.detailData.barCode = ''
  887. self.detailData.bpQuantity = ''
  888. self.detailData.gyQuantity = ''
  889. self.detailData.myQuantity = ''
  890. self.detailData.note = ''
  891. self.detailData.fileSavePath = []
  892. self.pointblur()
  893. plus.key.hideSoftKeybord();
  894. // showToast 弹窗关闭后执行跳转
  895. self.switchTab(1)
  896. }
  897. });
  898. } catch (e) {
  899. console.error("添加数据,报错", e)
  900. }
  901. }).catch(errors => {
  902. console.log(errors)
  903. uni.$u.toast(errors[0].message)
  904. this.pointblur()
  905. })
  906. },
  907. async handleSaveDetail() {
  908. this.$refs['uForm1'].validate().then(async () => {
  909. // 使用 map 方法提取需要的属性值
  910. console.log('aaaa', this.detailData)
  911. const urls = this.detailData.fileSavePath.map(item => item.url);
  912. // 使用 join 方法将剩余元素以逗号拼接为字符串
  913. const fileSavePath = urls.join(',');
  914. console.log(fileSavePath);
  915. if ('id' in this.detailData) {
  916. // barCode: '',
  917. // bpQuantity: '',
  918. // gyQuantity: '',
  919. // myQuantity: '',
  920. // note: "",
  921. // fileSavePath: [],
  922. try {
  923. await updateSql('detail', {
  924. barCode: this.detailData.barCode,
  925. bpQuantity: this.detailData.bpQuantity || 1,
  926. gyQuantity: this.detailData.gyQuantity || 0,
  927. myQuantity: this.detailData.myQuantity || 0,
  928. note: this.detailData.note,
  929. fileSavePath: fileSavePath
  930. }, {
  931. id: this.detailData.id
  932. })
  933. const self = this
  934. uni.showToast({
  935. title: "修改成功",
  936. icon: "none",
  937. success: function() {
  938. self.getData(self.baseData.uid)
  939. self.detailData = {
  940. barCode: '',
  941. bpQuantity: '',
  942. gyQuantity: '',
  943. myQuantity: '',
  944. note: "",
  945. fileSavePath: []
  946. }
  947. // showToast 弹窗关闭后执行跳转
  948. self.switchTab(2)
  949. }
  950. });
  951. } catch (e) {
  952. uni.showToast({
  953. title: "修改报错,请查看控制台",
  954. icon: "none"
  955. });
  956. console.error("修改报错", e)
  957. }
  958. } else {
  959. try {
  960. let b = await addSql('detail', {
  961. publicId: this.baseData.uid,
  962. barCode: this.detailData.barCode,
  963. bpQuantity: this.detailData.bpQuantity || 1,
  964. gyQuantity: this.detailData.gyQuantity || 0,
  965. myQuantity: this.detailData.myQuantity || 0,
  966. note: this.detailData.note,
  967. fileSavePath: fileSavePath
  968. })
  969. const self = this
  970. uni.showToast({
  971. title: "添加成功",
  972. icon: "none",
  973. success: function() {
  974. self.getData(self.baseData.uid)
  975. self.detailData = {
  976. barCode: '',
  977. bpQuantity: '',
  978. gyQuantity: '',
  979. myQuantity: '',
  980. note: "",
  981. fileSavePath: []
  982. }
  983. // showToast 弹窗关闭后执行跳转
  984. self.switchTab(2)
  985. }
  986. });
  987. } catch (e) {
  988. console.error("添加数据,报错", e)
  989. }
  990. }
  991. }).catch(errors => {
  992. console.log(errors)
  993. uni.$u.toast(errors[0].message)
  994. })
  995. },
  996. switchTab(index) {
  997. console.log('index的值为', index)
  998. if (index == 1) {
  999. setTimeout(() => {
  1000. console.log('隐藏')
  1001. plus.key.hideSoftKeybord();
  1002. // uni.hideKeyboard()
  1003. }, 700)
  1004. }
  1005. // if (index == 1) {
  1006. // console.log('隐藏键盘')
  1007. // uni.hideKeyboard();
  1008. // // document.activeElement.blur()
  1009. // }
  1010. this.activeTab = index; // 切换页面
  1011. },
  1012. async openSqlite() {
  1013. // 打开数据库
  1014. try {
  1015. let b = await openSqlite()
  1016. // uni.showToast({
  1017. // title: "打开数据库成功",
  1018. // icon: "none"
  1019. // })
  1020. } catch (e) {
  1021. console.error("打开数据库,报错", e)
  1022. }
  1023. },
  1024. // 创建表
  1025. async createTable() {
  1026. let sql = this.createTableSql_outbound()
  1027. try {
  1028. let exist = await isTable(this.tableName)
  1029. console.log("表是否存在", exist)
  1030. if (!exist) {
  1031. let res = await executeSql(sql)
  1032. uni.showToast({
  1033. title: "新增数据表成功",
  1034. icon: "none"
  1035. })
  1036. console.log("新增表ord_storage_order", res)
  1037. } else {
  1038. // uni.showToast({
  1039. // title: "数据表已存在",
  1040. // icon: "none"
  1041. // })
  1042. }
  1043. } catch (e) {
  1044. uni.showToast({
  1045. title: "新增数据表失败",
  1046. icon: "none"
  1047. })
  1048. console.error("新增表报错ord_storage_order", e)
  1049. }
  1050. },
  1051. // 创建选样表
  1052. async createDetailTable() {
  1053. let sql = this.createTableSql_detail()
  1054. try {
  1055. let exist = await isTable('detail')
  1056. console.log("表是否存在", exist)
  1057. if (!exist) {
  1058. let res = await executeSql(sql)
  1059. uni.showToast({
  1060. title: "新增数据表成功",
  1061. icon: "none"
  1062. })
  1063. console.log("新增表detail", res)
  1064. } else {
  1065. // uni.showToast({
  1066. // title: "数据表已存在",
  1067. // icon: "none"
  1068. // })
  1069. }
  1070. } catch (e) {
  1071. uni.showToast({
  1072. title: "新增数据表失败",
  1073. icon: "none"
  1074. })
  1075. console.error("新增表报错ord_storage_order", e)
  1076. }
  1077. },
  1078. /**
  1079. * 创建表, 仅供参考
  1080. * @returns {string}
  1081. * 因为java后台用的id,所以这里用fid 作为自增id
  1082. */
  1083. createTableSql_outbound() {
  1084. return "CREATE TABLE IF NOT EXISTS `public` (" +
  1085. " `id` INTEGER PRIMARY KEY AUTOINCREMENT," +
  1086. " `uid` varchar(20) DEFAULT NULL ," +
  1087. " `exhibitionName` varchar(50) DEFAULT NULL ," +
  1088. " `customerName` varchar(50) DEFAULT NULL ," +
  1089. " `receiver` varchar(50) DEFAULT NULL ," +
  1090. " `exhibitionNote` varchar(500) DEFAULT NULL ," +
  1091. " `fileSavePath` varchar(2000) DEFAULT NULL ," +
  1092. " `createTime` datetime DEFAULT NULL default(datetime('now','localtime')) ," +
  1093. " `updateTime` datetime DEFAULT NULL default(datetime('now','localtime')) ," +
  1094. " `deleted` char(1) DEFAULT '0' " +
  1095. "); "
  1096. },
  1097. createTableSql_detail() {
  1098. return "CREATE TABLE IF NOT EXISTS `detail` (" +
  1099. " `id` INTEGER PRIMARY KEY AUTOINCREMENT," +
  1100. " `publicId` varchar(20) NOT NULL ," +
  1101. " `barCode` varchar(50) NOT NULL ," +
  1102. " `bpQuantity` INT NOT NULL ," +
  1103. " `gyQuantity` INT NOT NULL ," +
  1104. " `myQuantity` INT NOT NULL ," +
  1105. " `note` varchar(500) DEFAULT NULL ," +
  1106. " `fileSavePath` varchar(2000) DEFAULT NULL ," +
  1107. " `createTime` TEXT DEFAULT NULL default(datetime('now','localtime')) ," +
  1108. " `updateTime` TEXT DEFAULT NULL default(datetime('now','localtime')) ," +
  1109. " `deleted` char(1) DEFAULT '0' " +
  1110. "); "
  1111. },
  1112. // 添加数据
  1113. async addData() {
  1114. const uniqueId = Date.now().toString();
  1115. const result = this.fileSavePath.join(','); // 使用逗号作为分隔符
  1116. try {
  1117. let b = await addSql(this.tableName, {
  1118. uid: uniqueId,
  1119. exhibitionName: this.baseData.exhibitionName,
  1120. customerName: this.baseData.customerName,
  1121. receiver: this.baseData.receiver,
  1122. exhibitionNote: this.baseData.exhibitionNote,
  1123. fileSavePath: result
  1124. })
  1125. console.log('vvvvvv', b)
  1126. uni.showToast({
  1127. title: "添加成功",
  1128. icon: "none"
  1129. });
  1130. this.switchTab(1)
  1131. } catch (e) {
  1132. console.error("添加数据,报错", e)
  1133. }
  1134. },
  1135. toggleSelectAll(e) {
  1136. console.log(e.detail)
  1137. console.log(this.selectAll = !this.selectAll)
  1138. this.selectAll = e.detail.value[0] == false ? true : false
  1139. // console.log(this.selectAll)
  1140. this.selected = this.detailList.map(() => this.selectAll);
  1141. // console.log(this.selected)
  1142. },
  1143. toggleSelect(index) {
  1144. console.log(index)
  1145. this.selected[index] = !this.selected[index];
  1146. this.selectAll = this.selected.every(item => item);
  1147. this.selectedCount = this.selected.filter(value => value === true)
  1148. .length;
  1149. console.log(this.selectAll)
  1150. },
  1151. isEmptyObject(obj) {
  1152. return Object.keys(obj).length === 0;
  1153. },
  1154. async changeListData() {
  1155. const listToDelete = this.detailList.filter((item, index) =>
  1156. this.selected[index]).map(item => {
  1157. return {
  1158. id: item.id,
  1159. deleted: 1
  1160. };
  1161. });
  1162. if (this.isEmptyObject(listToDelete)) {
  1163. uni.showToast({
  1164. title: "请选择删除条目",
  1165. icon: "none"
  1166. });
  1167. return
  1168. }
  1169. console.log(listToDelete)
  1170. console.log('selected', this.selected)
  1171. let self = this
  1172. uni.showModal({
  1173. // title: '提示',
  1174. content: '确认删除选中的条目?',
  1175. success: async function(res) {
  1176. if (res.confirm) {
  1177. console.log('用户点击确定')
  1178. try {
  1179. await batchUpdate("detail",
  1180. listToDelete, "id")
  1181. // 过滤掉arr1中对应arr2中值为true的索引的元素
  1182. self.detailList = self.detailList
  1183. .filter((item, index) => !self
  1184. .selected[
  1185. index])
  1186. self.selected = self.selected
  1187. .filter(item => item !== true);
  1188. self.selectAll = false
  1189. console.log(self.list)
  1190. console.log("self.selected", self.selected)
  1191. uni.showToast({
  1192. title: "删除成功",
  1193. icon: "none",
  1194. success: function() {}
  1195. });
  1196. } catch (e) {
  1197. console.error("批量修改数据,报错", e)
  1198. }
  1199. } else if (res.cancel) {
  1200. console.log('用户点击取消')
  1201. }
  1202. }
  1203. })
  1204. },
  1205. goDetailPage(id) { //选样详情页面
  1206. console.log(id)
  1207. this.getDetailData(id).then(res => {
  1208. console.log('returneeeee', res);
  1209. res.forEach(item => {
  1210. if (item.fileSavePath === "") {
  1211. item
  1212. .fileSavePath = []; // 如果为空字符串,则设置为空数组
  1213. } else {
  1214. // 将 fileSavePath 字符串转换为数组
  1215. const files = item.fileSavePath
  1216. .split(',');
  1217. // 使用 map() 方法将每个文件路径转换为对象
  1218. item.fileSavePath = files.map(
  1219. file => {
  1220. const fileName = file
  1221. .split('/')
  1222. .pop(); // 提取文件名
  1223. const extname =
  1224. fileName.split('.')
  1225. .pop(); // 提取扩展名
  1226. return {
  1227. name: fileName,
  1228. extname: extname,
  1229. url: file
  1230. };
  1231. });
  1232. }
  1233. });
  1234. this.detailData = res[0]
  1235. this.switchTab(1)
  1236. })
  1237. },
  1238. //图片预览
  1239. previewImage(item, i) {
  1240. uni.previewImage({
  1241. current: i,
  1242. urls: item.fileSavePath
  1243. });
  1244. },
  1245. // 比较两个对象是否相同
  1246. compareObjects(obj1, obj2) {
  1247. // 将两个对象转换为字符串并进行比较
  1248. const str1 = JSON.stringify(obj1);
  1249. const str2 = JSON.stringify(obj2);
  1250. // 比较转换后的字符串是否相等
  1251. return str1 === str2;
  1252. }
  1253. },
  1254. };
  1255. </script>
  1256. <style>
  1257. /* .status_bar {
  1258. height: var(--status-bar-height);
  1259. width: 100%;
  1260. } */
  1261. .container {
  1262. position: relative;
  1263. width: 100%;
  1264. /* height: 520px; */
  1265. /* border: solid 1px blue; */
  1266. /* height: 100vh; */
  1267. overflow: hidden;
  1268. /* 隐藏溢出内容,禁止滚动 */
  1269. }
  1270. .header {
  1271. position: fixed;
  1272. background-color: #253a6f;
  1273. height: 170rpx;
  1274. width: 100%;
  1275. z-index: 1;
  1276. display: flex;
  1277. }
  1278. .scroll-view {
  1279. position: absolute;
  1280. left: 50%;
  1281. top: 60%;
  1282. transform: translate(-50%, -50%);
  1283. width: 90%;
  1284. height: 100%;
  1285. overflow: auto;
  1286. /* 设置滚动 */
  1287. background-color: white;
  1288. /* background-color: #EDEDED; */
  1289. border-radius: 5px;
  1290. /* padding: 0 20px; */
  1291. z-index: 999;
  1292. }
  1293. .content {
  1294. width: 100%;
  1295. margin-bottom: 80px;
  1296. overflow-y: auto;
  1297. z-index: 999;
  1298. /* background-color: #EDEDED; */
  1299. background-color: white;
  1300. /* border: 1px solid red; */
  1301. /* 允许内容纵向滚动 */
  1302. /* 此处设置滚动区域的内容样式 */
  1303. }
  1304. .content1 {
  1305. height: 100%;
  1306. /* width: 100%;
  1307. margin-bottom: 50px;
  1308. overflow-y: auto;
  1309. z-index: 999; */
  1310. /* background-color: #EDEDED; */
  1311. /* background-color: white; */
  1312. /* border: 1px solid blue; */
  1313. padding: 0 20px;
  1314. /* 允许内容纵向滚动 */
  1315. /* 此处设置滚动区域的内容样式 */
  1316. }
  1317. .content2 {
  1318. /* width: 100%;
  1319. margin-bottom: 50px;
  1320. overflow-y: auto;
  1321. z-index: 999; */
  1322. background-color: #EDEDED;
  1323. /* background-color: white; */
  1324. /* border: 1px solid blue; */
  1325. /* padding: 0 20px; */
  1326. /* 允许内容纵向滚动 */
  1327. /* 此处设置滚动区域的内容样式 */
  1328. }
  1329. .icon {
  1330. width: 30rpx;
  1331. height: 30rpx;
  1332. margin-right: 10rpx;
  1333. }
  1334. .segmented-control-item {
  1335. flex: 1;
  1336. text-align: center;
  1337. padding: 10px;
  1338. color: white;
  1339. }
  1340. .underline {
  1341. bottom: 0;
  1342. left: 0;
  1343. width: 20%;
  1344. height: 1px;
  1345. background-color: white;
  1346. /* 设置下划线的颜色 */
  1347. display: none;
  1348. margin: 0 auto;
  1349. }
  1350. .segmented-control-item.active .underline {
  1351. display: block;
  1352. }
  1353. .card-bottom {
  1354. touch-action: none;
  1355. // height: 60px;
  1356. position: fixed;
  1357. bottom: 0;
  1358. width: 100%;
  1359. z-index: 999;
  1360. background-color: white;
  1361. border-top: 1px;
  1362. display: flex;
  1363. flex-direction: column;
  1364. }
  1365. .list {
  1366. margin-bottom: 10px;
  1367. /* border: 1px solid blue; */
  1368. border-radius: 5px;
  1369. background-color: white;
  1370. }
  1371. .list-item {
  1372. display: flex;
  1373. /* border: 1px solid red; */
  1374. }
  1375. .item {
  1376. display: flex;
  1377. align-items: center;
  1378. padding-top: 10px;
  1379. }
  1380. .bottom-bar {
  1381. position: fixed;
  1382. /* 将底部操作栏固定在页面底部 */
  1383. left: 0;
  1384. bottom: 0;
  1385. width: 100%;
  1386. height: 80rpx;
  1387. /* text-align: center; */
  1388. background-color: white;
  1389. /* color: #fff; */
  1390. font-size: 32rpx;
  1391. line-height: 80rpx;
  1392. z-index: 999;
  1393. }
  1394. .box {
  1395. width: 150rpx;
  1396. height: 50rpx;
  1397. /* border: 2rpx solid #333; */
  1398. border-radius: 4rpx;
  1399. display: flex;
  1400. justify-content: center;
  1401. align-items: center;
  1402. }
  1403. .text {
  1404. color: white;
  1405. }
  1406. .gap {
  1407. width: 20rpx;
  1408. }
  1409. .image-item {
  1410. margin-right: 5px;
  1411. margin-bottom: 5px;
  1412. border: solid 1px #dadbde;
  1413. }
  1414. button::after {
  1415. border: 0; // 或者 border: none;
  1416. }
  1417. uni-checkbox .uni-checkbox-input {
  1418. border-radius: 80rpx !important;
  1419. border: 2px solid #ccc;
  1420. }
  1421. /deep/ uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
  1422. font: normal normal normal 14px/1 uni;
  1423. content: "EA08";
  1424. font-size: 0;
  1425. /* 重点使用这一步取消的默认样式 */
  1426. position: absolute;
  1427. top: 50%;
  1428. left: 50%;
  1429. transform: translate(-50%, -48%) scale(1);
  1430. -webkit-transform: translate(-50%, -48%) scale(1);
  1431. }
  1432. /deep/ .uni-checkbox-input-checked::before {
  1433. width: 19px;
  1434. height: 19px;
  1435. background: #253a6f;
  1436. border-radius: 50%;
  1437. /* background: url(../../static/img/seal.png) no-repeat center; */
  1438. }
  1439. </style>