lhypbMessage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view>
  3. <view class="u-m-20">
  4. <u-form :model="form" ref="form" label-width="220" :error-type="errorType">
  5. <u-form-item label="样品名称" prop="yangPinMingCheng" required>
  6. <u-input placeholder="请输入样品名称" v-model="form.yangPinMingCheng" />
  7. </u-form-item>
  8. <u-form-item label="样品编号">
  9. <u-input placeholder="请输入样品编号" v-model="form.yangPinBianHao" disabled />
  10. </u-form-item>
  11. <u-form-item label="姓名">
  12. <u-input placeholder="请输入姓名" v-model="form.xingMing" />
  13. </u-form-item>
  14. <u-form-item label="性别">
  15. <u-radio-group v-model="form.xingBie">
  16. <u-radio v-for="(it, index) in sexList" :key="index" :name="it.name">
  17. {{it.name}}
  18. </u-radio>
  19. </u-radio-group>
  20. </u-form-item>
  21. <u-form-item label="年龄">
  22. <u-input placeholder="请输入年龄" v-model="form.nianLing" />
  23. </u-form-item>
  24. <u-form-item label="送检批号/编号" prop="songJianPiHao" required>
  25. <u-input placeholder="请输入送检批号/编号" v-model="form.songJianPiHao" />
  26. </u-form-item>
  27. <u-form-item label="样本状态" prop="yangPinZhuangTai" required>
  28. <u-input placeholder="请选择样本状态" type="select" v-model="form.yangPinZhuangTai"
  29. @click="sheetClick('state')" />
  30. </u-form-item>
  31. <u-form-item label="送检时间" prop="songJianShiJian" required>
  32. <u-input placeholder="请选择送检时间" type="select" v-model="form.songJianShiJian"
  33. @click="dateClick('inspect')" />
  34. </u-form-item>
  35. <u-form-item label="备注">
  36. <u-input placeholder="请输入备注" v-model="form.beiZhu1" />
  37. </u-form-item>
  38. <view class="qingshe" style="background-color: #99cc66;">
  39. <view class="qingTitle" style="color: #FFFFFF;">
  40. 常规项目选择
  41. </view>
  42. </view>
  43. <u-form-item label="检测类型">
  44. <u-input placeholder="请选择检测类型" type="select" v-model="form.jianCeType"
  45. @click="selectClick('jianCeType')" />
  46. </u-form-item>
  47. <u-form-item label="检测项目" prop="name" label-position="top">
  48. <checkbox-group v-for="(it, x) in form.jianCeList" :key="x" @click="changeIndex(it,x)">
  49. <label class=" uni-list-cell uni-list-cell-pd"
  50. v-show="(it.jian_ce_lei_bie_==form.jianCeType) || it.checked"
  51. style="display: flex;margin: 15rpx 10rpx;font-size: 20rpx;line-height: 40rpx;">
  52. <view>
  53. <checkbox :checked="it.checked" :value="it.id_" />
  54. </view>
  55. <view style="margin-left: 10rpx;font-size: 28rpx;">
  56. <view>
  57. {{it.jian_ce_lei_bie_ || ''}}-{{it.jian_ce_xiang_mu_ || ''}}
  58. <text style="color: red;">[{{it.zhe_hou_jia_ge_ || '当'}}元]</text>
  59. </view>
  60. <view>{{it.yi_ju_de_biao_zhu || ''}}</view>
  61. <view>报告周期(工作日):{{it.bao_gao_zhou_qi_g || '当'}}天</view>
  62. <view>送样要求:{{it.yang_pin_tiao_jia || ''}}</view>
  63. </view>
  64. </label>
  65. </checkbox-group>
  66. </u-form-item>
  67. <view class="qingshe" style="background-color: #99cc66;">
  68. <view class="qingTitle" style="color: #FFFFFF;">
  69. 套餐选择
  70. </view>
  71. </view>
  72. <u-form-item label="选择套餐" prop="name" label-position="top">
  73. <checkbox-group v-for="(it, x) in form.taoCanList" :key="x" @click="changeTaoCanIndex(it,x)">
  74. <label class=" uni-list-cell uni-list-cell-pd"
  75. style="display: flex;align-items: center;margin: 15rpx 10rpx;font-size: 20rpx;line-height: 40rpx;">
  76. <view>
  77. <checkbox :checked="it.checked" :value="it.id_" />
  78. </view>
  79. <view style="margin-left: 10rpx;font-size: 28rpx;">
  80. <view>
  81. {{it.tao_can_ming_chen || ''}}
  82. </view>
  83. </view>
  84. </label>
  85. </checkbox-group>
  86. </u-form-item>
  87. <view class="qingshe" @click="form.showBoolean1 = !form.showBoolean1">
  88. <view>
  89. </view>
  90. <view>
  91. <u-icon name="arrow-up" v-if="form.showBoolean1"></u-icon>
  92. <u-icon name="arrow-down" v-else></u-icon>
  93. </view>
  94. </view>
  95. <block v-if="form.showBoolean1">
  96. <u-form-item label="样品类型①">
  97. <u-input placeholder="请选择样品类型①" type="select" v-model="form.yangPinLeiXing"
  98. @click="sheetClick('yangpinType1')" />
  99. </u-form-item>
  100. <u-form-item label="样品运输条件①">
  101. <u-input placeholder="请选择样品运输条件①" type="select" v-model="form.yangBenYunShuTiao"
  102. @click="sheetClick('transportType1')" />
  103. </u-form-item>
  104. <u-form-item label="数量①">
  105. <uni-number-box v-model="form.shuLiang"></uni-number-box>
  106. </u-form-item>
  107. <u-form-item label="样品规格①">
  108. <u-input placeholder="请输入样品规格①" v-model="form.yangPinGuiGe" />
  109. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification1')">规格
  110. </u-button>
  111. </u-form-item>
  112. </block>
  113. <view class="qingshe" @click="form.showBoolean2 = !form.showBoolean2">
  114. <view>
  115. </view>
  116. <view>
  117. <u-icon name="arrow-up" v-if="form.showBoolean2"></u-icon>
  118. <u-icon name="arrow-down" v-else></u-icon>
  119. </view>
  120. </view>
  121. <block v-if="form.showBoolean2">
  122. <u-form-item label="样品类型②">
  123. <u-input placeholder="请选择样品类型②" type="select" v-model="form.yangPinLeiXingEr"
  124. @click="sheetClick('yangpinType2')" />
  125. </u-form-item>
  126. <u-form-item label="样品运输条件②">
  127. <u-input placeholder="请选择样品运输条件②" type="select" v-model="form.yangPinYunShuTiao"
  128. @click="sheetClick('transportType2')" />
  129. </u-form-item>
  130. <u-form-item label="数量②">
  131. <uni-number-box v-model="form.shuLiangEr"></uni-number-box>
  132. </u-form-item>
  133. <u-form-item label="样品规格②">
  134. <u-input placeholder="请输入样品规格②" v-model="form.yangPinGuiGeEr" />
  135. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification2')">规格
  136. </u-button>
  137. </u-form-item>
  138. </block>
  139. <view class="qingshe" @click="form.showBoolean3 = !form.showBoolean3">
  140. <view>
  141. </view>
  142. <view>
  143. <u-icon name="arrow-up" v-if="form.showBoolean3"></u-icon>
  144. <u-icon name="arrow-down" v-else></u-icon>
  145. </view>
  146. </view>
  147. <block v-if="form.showBoolean3">
  148. <u-form-item label="样品类型③">
  149. <u-input placeholder="请选择样品类型③" type="select" v-model="form.yangPinLeiXingSan"
  150. @click="sheetClick('yangpinType3')" />
  151. </u-form-item>
  152. <u-form-item label="样品运输条件③">
  153. <u-input placeholder="请选择样品运输条件③" type="select" v-model="form.yangPinYunShuSan"
  154. @click="sheetClick('transportType3')" />
  155. </u-form-item>
  156. <u-form-item label="数量③">
  157. <uni-number-box v-model="form.shuLiangSan"></uni-number-box>
  158. </u-form-item>
  159. <u-form-item label="样品规格③">
  160. <u-input placeholder="请输入样品规格③" v-model="form.yangPinGuiGeSan" />
  161. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification3')">规格
  162. </u-button>
  163. </u-form-item>
  164. </block>
  165. <view class="qingshe" @click="form.showBoolean4 = !form.showBoolean4">
  166. <view>
  167. </view>
  168. <view>
  169. <u-icon name="arrow-up" v-if="form.showBoolean4"></u-icon>
  170. <u-icon name="arrow-down" v-else></u-icon>
  171. </view>
  172. </view>
  173. <block v-if="form.showBoolean4">
  174. <u-form-item label="样品类型④">
  175. <u-input placeholder="请选择样品类型④" type="select" v-model="form.yangPinLeiXingSi"
  176. @click="sheetClick('yangpinType4')" />
  177. </u-form-item>
  178. <u-form-item label="样品运输条件④">
  179. <u-input placeholder="请选择样品运输条件④" type="select" v-model="form.yangPinYunShuSi"
  180. @click="sheetClick('transportType4')" />
  181. </u-form-item>
  182. <u-form-item label="数量④">
  183. <uni-number-box v-model="form.shuLiangSi"></uni-number-box>
  184. </u-form-item>
  185. <u-form-item label="样品规格④">
  186. <u-input placeholder="请输入样品规格④" v-model="form.yangPinGuiGeSi" />
  187. <u-button slot="right" type="success" size="mini" @click="sheetClick('specification4')">规格
  188. </u-button>
  189. </u-form-item>
  190. </block>
  191. <u-form-item label="项目名称" prop="xiangMuMingCheng" v-if="form.weiTuoHeTong == '技术服务协议'">
  192. <u-input placeholder="请输入项目名称" v-model="form.xiangMuMingCheng" />
  193. </u-form-item>
  194. <u-form-item label="样品总价" prop="yangPinZongJia">
  195. <u-input v-model="form.yangPinZongJia" disabled />
  196. </u-form-item>
  197. </u-form>
  198. <view style="height: 220rpx;"></view>
  199. <view class="btnBottom">
  200. <u-button type="error" class="btn" @click="deletSing">取消
  201. </u-button>
  202. <u-button type="error" class="btn" @click="sumbitSing">保存
  203. </u-button>
  204. </view>
  205. </view>
  206. <u-action-sheet :list="list" v-model="sheetShow" @click="actionSheetCallback" z-index="2000">
  207. </u-action-sheet>
  208. <u-select v-model="selectShow" :list="list" @confirm="selectConfirm"></u-select>
  209. <u-calendar v-model="dateShow" :mode="mode" max-date="2050-01-01" @change="dateChange"></u-calendar>
  210. </view>
  211. </template>
  212. <script>
  213. import order from './test.json'
  214. export default {
  215. props: {
  216. jianCeTypeList: {
  217. type: Array,
  218. default: () => {
  219. return []
  220. }
  221. }
  222. },
  223. data() {
  224. return {
  225. errorType: ['toast'],
  226. form: {
  227. },
  228. //样本状态
  229. sampleStateList: order.sampleState,
  230. sexList: order.sex,
  231. //样本类型
  232. sampleTypeList: order.sampleType,
  233. //样本运输条件
  234. transportTypeList: order.transportType,
  235. //样本规格
  236. specificationList: order.specification,
  237. list: [],
  238. listType: '',
  239. sheetShow: false,
  240. selectShow: false,
  241. dateShow: false,
  242. mode: 'date',
  243. type: "",
  244. rules: {
  245. yangPinMingCheng: [{
  246. required: true,
  247. message: '请输入样品名称',
  248. trigger: 'blur',
  249. }],
  250. songJianPiHao: [{
  251. required: true,
  252. message: '请输入送检批号/编号',
  253. trigger: 'blur',
  254. }],
  255. yangPinZhuangTai: [{
  256. required: true,
  257. message: '请输入样本状态',
  258. trigger: 'blur',
  259. }],
  260. songJianShiJian: [{
  261. required: true,
  262. message: '请输入送检时间',
  263. trigger: 'blur',
  264. }],
  265. }
  266. }
  267. },
  268. onReady() {
  269. this.$refs.form.setRules(this.rules);
  270. },
  271. methods: {
  272. getInit(data) {
  273. this.form = data
  274. },
  275. changeIndex(it, x) {
  276. let itemData = this.form
  277. this.form.jianCeList[x].checked = !this.form.jianCeList[x].checked
  278. let show = itemData.jianCeList.some(item => item.id_ == '1039826037036285952' || item.id_ ==
  279. '1040205909151711232')
  280. if (show) {
  281. itemData.mingChengShow = true
  282. }
  283. this.getTotal()
  284. },
  285. changeTaoCanIndex(it, x) {
  286. let itemData = this.form
  287. this.form.taoCanList[x].checked = !this.form.taoCanList[x].checked
  288. this.getTotal()
  289. },
  290. getTotal() {
  291. var itemTotal = 0
  292. this.form.jianCeList.forEach((it, x) => {
  293. if (it.checked) {
  294. itemTotal += parseFloat(it.zhe_hou_jia_ge_ || 0)
  295. }
  296. })
  297. this.form.yangPinZongJia = (itemTotal).toFixed(2)
  298. },
  299. selectClick(type) {
  300. this.listType = type
  301. this.selectShow = true
  302. if (type == 'jianCeType') {
  303. this.list = this.jianCeTypeList
  304. }
  305. },
  306. sheetClick(type) {
  307. this.listType = type
  308. this.sheetShow = true
  309. if (type == 'state') {
  310. this.list = this.sampleStateList
  311. }
  312. //1
  313. if (type.includes('yangpinType')) {
  314. this.list = this.sampleTypeList
  315. }
  316. if (type.includes('transportType')) {
  317. this.list = this.transportTypeList
  318. }
  319. if (type.includes('specification')) {
  320. this.list = this.specificationList
  321. }
  322. if (type == 'disposition') {
  323. this.list = this.dispositionList
  324. }
  325. },
  326. //下拉框回调
  327. actionSheetCallback(e) {
  328. let that = this
  329. let lists = that.form
  330. if (this.listType == 'state') {
  331. lists.yangPinZhuangTai = this.list[e].text
  332. }
  333. //1
  334. if (this.listType == 'yangpinType1') {
  335. lists.yangPinLeiXing = that.list[e].text
  336. }
  337. if (this.listType == 'transportType1') {
  338. lists.yangBenYunShuTiao = that.list[e].text
  339. }
  340. if (this.listType == 'specification1') {
  341. lists.yangPinGuiGe = that.list[e].text
  342. }
  343. //2
  344. if (this.listType == 'yangpinType2') {
  345. lists.yangPinLeiXingEr = that.list[e].text
  346. }
  347. if (this.listType == 'transportType2') {
  348. lists.yangPinYunShuTiao = that.list[e].text
  349. }
  350. if (this.listType == 'specification2') {
  351. lists.yangPinGuiGeEr = that.list[e].text
  352. }
  353. //3
  354. if (this.listType == 'yangpinType3') {
  355. lists.yangPinLeiXingSan = that.list[e].text
  356. }
  357. if (this.listType == 'transportType3') {
  358. lists.yangPinYunShuSan = that.list[e].text
  359. }
  360. if (this.listType == 'specification3') {
  361. lists.yangPinGuiGeSan = that.list[e].text
  362. }
  363. //3
  364. if (this.listType == 'yangpinType4') {
  365. lists.yangPinLeiXingSi = that.list[e].text
  366. }
  367. if (this.listType == 'transportType4') {
  368. lists.yangPinYunShuSi = that.list[e].text
  369. }
  370. if (this.listType == 'specification4') {
  371. lists.yangPinGuiGeSi = that.list[e].text
  372. }
  373. if (this.listType == 'disposition') {
  374. this.form.yangBenChuLi = this.list[e].text
  375. }
  376. },
  377. //调用日期组件
  378. dateClick(type) {
  379. if (type == 'inspect') {
  380. this.type = type
  381. this.mode = 'date'
  382. this.dateShow = true
  383. }
  384. },
  385. //日期回调
  386. dateChange(e) {
  387. if (this.type == 'inspect') {
  388. this.form.songJianShiJian = e.result
  389. }
  390. },
  391. deletSing() {
  392. this.$emit("deletClick")
  393. },
  394. sumbitSing() {
  395. if (this.form.yangPinZongJia == '') {
  396. this.form.yangPinZongJia = 0
  397. }
  398. // let showIndex = this.form.lhypb.findIndex(item => item.jianCeXiangMu == '')
  399. // if (showIndex >= 0) {
  400. // uni.showToast({
  401. // title: `请在样品信息${showIndex+1}选择委托单需要检测项目`,
  402. // icon: 'none',
  403. // duration: 2000
  404. // })
  405. // return
  406. // }
  407. this.$refs.form.validate(valid => {
  408. if (valid) {
  409. this.$emit("sumbitSingClick", this.form)
  410. } else {
  411. uni.showToast({
  412. title: '必填项未填写',
  413. icon: 'none',
  414. duration: 2000
  415. })
  416. }
  417. });
  418. }
  419. }
  420. }
  421. </script>
  422. <style lang="scss" scoped>
  423. .qingshe {
  424. background-color: #f0f9eb;
  425. color: #67c23a;
  426. padding: 15rpx 20rpx;
  427. border-radius: 8rpx;
  428. display: flex;
  429. justify-content: space-between;
  430. align-items: center;
  431. margin-top: 25rpx;
  432. }
  433. .btnBottom {
  434. z-index: 1500;
  435. height: 220rpx;
  436. background-color: #FFFFFF;
  437. position: fixed;
  438. bottom: 0;
  439. left: 0;
  440. right: 0;
  441. .btn {
  442. margin: 20rpx;
  443. }
  444. }
  445. </style>