耀实惠小程序
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.

349 lines
8.2 KiB

2 years ago
  1. <template>
  2. <view class="medicine">
  3. <view class="top"></view>
  4. <view class="steps">
  5. <text>上传处方</text>
  6. <u-icon name="arrow-rightward" size="15"></u-icon>
  7. <text>药师接单与审方</text>
  8. <u-icon name="arrow-rightward" size="15"></u-icon>
  9. <text>审方通过</text>
  10. <u-icon name="arrow-rightward" size="15"></u-icon>
  11. <text>在线支付</text>
  12. <u-icon name="arrow-rightward" size="15"></u-icon>
  13. <text>发货</text>
  14. </view>
  15. <view class="card">
  16. <view class="title_box">
  17. <text class="title">请上传清晰完整的处方照片</text>
  18. <button class="look" @click="lookMode">查看处方示例</button>
  19. </view>
  20. <text class="hint_info">药师将根据您上传的处方单信息为您抓药</text>
  21. <view class="upload">
  22. <u-upload :header="headerOptions" width="200" height="200" :action="action" @on-success="uploadSuccess" @on-error="uploadErr" @on-remove="uploadRemove" ></u-upload>
  23. </view>
  24. </view>
  25. <!-- 用药人 -->
  26. <view class="user">
  27. <view class="to_medicine_man" @click="selectUser" v-if="!drugUserInfo">
  28. <text class="title">添加用药人信息</text>
  29. <u-icon name="arrow-right"></u-icon>
  30. </view>
  31. <select-drug-user v-if="drugUserInfo" :DrugInfo='drugUserInfo' :type="2" @selectUser="selectUser"></select-drug-user>
  32. </view>
  33. <!-- 提交 -->
  34. <view class="footer flex align-center justify-center">
  35. <button @click="toSuccess" class="add_btn">提交处方</button>
  36. </view>
  37. <!-- 示例图片 -->
  38. <view class="mask" v-show="show">
  39. <view class="show_box">
  40. <view class="clear_medicine_pic">
  41. <u-icon name="close" size="40" color="#fff" @click="toCloseShow"></u-icon>
  42. </view>
  43. <image class="medicine_pic" :src="img_url+'medicine_pic.png'" mode=""></image>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import config from "@/utils/js/config.js"
  50. import { UPLOAD_IMG, TOKEN_HEADER_NAME } from '@/config/settings.js'
  51. export default {
  52. data() {
  53. return {
  54. action: UPLOAD_IMG,
  55. img_url: config.img_url,
  56. show: false,
  57. drugUserInfo: null,
  58. type: '',
  59. fileList: [],
  60. address: {},
  61. url: '' ,// 保存进来的地址 防止用户添加信息后 返回路径混乱
  62. // 购买的商品数据
  63. goodsId: '',
  64. isSituation: 0,
  65. num: '',
  66. price: '',
  67. goodSkuParam: '',
  68. prescriptionId: 0,
  69. isZone: '',
  70. prescription: null, // 0 从home页来 1 从商品页来
  71. createOrderType: '',
  72. orderType: '',
  73. payType: ''
  74. }
  75. },
  76. onLoad(options) {
  77. // 保存用户从那里来 选择地址后 原来返回
  78. let pages_url = getCurrentPages();
  79. this.url = pages_url[pages_url.length -2].route;
  80. this.orderType = options.orderType;
  81. this.payType = options.payType;
  82. this.createOrderType = options.createOrderType;
  83. this.goodsId = options.goodsId;
  84. this.isSituation = options.isSituation;
  85. this.num = options.num;
  86. this.price = options.price;
  87. this.goodSkuParam = options.goodSkuParam;
  88. this.prescriptionId = options.prescriptionId
  89. this.isZone = options.isZone
  90. this.prescription = this.prescription == 0 ? 0: 1;// 0 从home页来 1 从商品页来
  91. this.type = options.type
  92. uni.$on('uploadDrugUserInfo', obj => {
  93. console.log('-------------')
  94. this.drugUserInfo = obj
  95. })
  96. uni.$on('getAddressId', obj => {
  97. // 获取用户选择的地址
  98. this.drugUserInfo = obj
  99. })
  100. },
  101. onUnload() {
  102. uni.$off('uploadDrugUserInfo');
  103. uni.$off('getAddressId');
  104. this.$tools.navigateTo({
  105. url: this.url
  106. })
  107. },
  108. computed: {
  109. headerOptions () {
  110. return {
  111. [TOKEN_HEADER_NAME]: this.$store.state.userToken
  112. }
  113. }
  114. },
  115. methods: {
  116. // 查看示例图
  117. lookMode() {
  118. this.show = true;
  119. },
  120. toCloseShow() {
  121. this.show = false;
  122. },
  123. toSuccess() {
  124. console.log(this.fileList)
  125. if (!this.fileList.length) return this.$Toast('请上传处方照片')
  126. if (!this.drugUserInfo) return this.$Toast('请添加用药人信息');
  127. this.$api('patter', { drugUserId: this.drugUserInfo.id, pic: this.fileList.join() })
  128. .then(res => {
  129. console.log(res.result.id)
  130. if (res.code === 200) {
  131. if(this.type == 'prescription'){
  132. this.$tools.navigateTo({
  133. url: `/pagesC/subscribe/confirmSubscribe?addressId=${this.drugUserInfo.id}&orderType=${this.orderType}&imgUploadShow=${this.fileList.toString()}&medicineMan=${JSON.stringify(this.drugUserInfo)}&goodsId=${this.goodsId}&num=${this.num}&price=${this.price}&goodSkuParam=${this.goodSkuParam}&prescriptionId=${this.drugUserInfo.id}&createOrderType=${this.createOrderType}&payType=${this.payType}&isZone=${this.isZone}&patterId=${res.result.id}`
  134. })
  135. }else {
  136. uni.navigateTo({
  137. url: "./../success/index"
  138. })
  139. }
  140. }else{
  141. this.$Toast(res.message)
  142. }
  143. }).catch(err => {
  144. this.$Toast(err.message)
  145. })
  146. },
  147. selectUser () {
  148. this.$tools.navigateTo({
  149. url: `/pagesA/my_other_list/prescription/select_medicine_man/index?type=${this.type}&goodsId=${this.goodsId}&isSituation=${this.isSituation}&num=${this.num}&price=${this.price}&goodSkuParam=${this.goodSkuParam}&prescriptionId=${this.prescriptionId}`
  150. })
  151. },
  152. uploadSuccess (res) {
  153. this.fileList.push(res.result)
  154. },
  155. uploadErr (err) {
  156. console.log(res)
  157. },
  158. uploadRemove (index, lists) {
  159. this.fileList.splice(index, 1)
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .medicine {
  166. padding-bottom: 140rpx;
  167. }
  168. .top{
  169. position: fixed;
  170. z-index: -1;
  171. top: 0;
  172. left: 0;
  173. width: 100%;
  174. height: 636rpx;
  175. background: linear-gradient(180deg,#01aeea, #f1fbff);
  176. }
  177. .steps{
  178. font-size: 28rpx;
  179. color: #E9E9E9;
  180. padding-top: 57rpx;
  181. padding-left: 17rpx;
  182. display: flex;
  183. align-items: center;
  184. text{
  185. padding-right: 7rpx;
  186. padding-left: 7rpx;
  187. }
  188. }
  189. .card{
  190. width: 717rpx;
  191. margin: 0 auto;
  192. margin-top: 60rpx ;
  193. border-radius: 12rpx;
  194. background-color: #fff;
  195. .title_box{
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: center;
  199. padding-top: 17rpx;
  200. box-sizing: border-box;
  201. .title{
  202. font-size: 34rpx;
  203. font-weight: bold;
  204. margin-left: 28rpx;
  205. color: #000;
  206. }
  207. .look{
  208. // width: 136rpx;
  209. height: 48rpx;
  210. padding: 10rpx;
  211. background-color: #eee;
  212. border-radius: 18rpx;
  213. border: 1px solid #01AEEA;
  214. color: #01AEEA;
  215. font-size: 30rpx;
  216. margin-right: 10rpx;
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. }
  221. }
  222. .hint_info{
  223. display: inline-block;
  224. padding-top: 27rpx;
  225. padding-bottom: 44rpx;
  226. margin-left: 28rpx;
  227. font-size: 30rpx;
  228. box-sizing: border-box;
  229. color: #B7B7B7;
  230. }
  231. .upload{
  232. padding-left: 10rpx;
  233. padding-bottom: 44rpx;
  234. }
  235. }
  236. .user{
  237. width: 717rpx;
  238. margin: 15rpx auto 0;
  239. border-radius: 12rpx;
  240. background-color: #fff;
  241. box-shadow: 0 3px 6px 0 rgba(0,0,0,0.16);
  242. .to_medicine_man{
  243. display: flex;
  244. align-items: center;
  245. justify-content: space-between;
  246. .title{
  247. padding-left: 28rpx;
  248. padding-top: 30rpx;
  249. padding-bottom: 30rpx;
  250. font-size: 32rpx;
  251. }
  252. /deep/ .u-icon__icon{
  253. padding-right: 37rpx;
  254. }
  255. }
  256. }
  257. .footer {
  258. width: 100%;
  259. position: fixed;
  260. left: 0;
  261. bottom: 0;
  262. background: #fff;
  263. height: 120rpx;
  264. }
  265. .add_btn{
  266. width: 668rpx;
  267. height: 88rpx;
  268. border-radius: 38rpx;
  269. background-color: #01AEEA;
  270. text-align: center;
  271. line-height: 88rpx;
  272. color: #fff;
  273. font-size: 32rpx;
  274. }
  275. .mask{
  276. position: fixed;
  277. top: 0;
  278. left: 0;
  279. z-index: 22;
  280. width: 100%;
  281. height: 100%;
  282. background-color: #000;
  283. .show_box{
  284. width: 750rpx;
  285. height: 100vh;
  286. .clear_medicine_pic{
  287. display: flex;
  288. justify-content: flex-end;
  289. padding-top: 42rpx;
  290. padding-right: 46rpx;
  291. padding-bottom: 50rpx;
  292. height: 140rpx;
  293. box-sizing: border-box;
  294. }
  295. .medicine_pic{
  296. width: 750rpx;
  297. height: 1026rpx;
  298. }
  299. }
  300. }
  301. .box {
  302. margin-left: 24rpx;
  303. display: flex;
  304. flex-direction: column;
  305. .name_box {
  306. font-size: 28rpx;
  307. color: #000;
  308. margin-top: 37rpx;
  309. margin-bottom: 17rpx;
  310. .name_btn {
  311. margin-left: 10rpx;
  312. font-size: 24rpx;
  313. color: #0C85FF;
  314. border-radius: 10rpx;
  315. border: 1px solid #0C85FF;
  316. padding: 5rpx 10rpx;
  317. }
  318. }
  319. .other_info {
  320. display: flex;
  321. font-size: 24rpx;
  322. padding-bottom: 23rpx;
  323. color: #000;
  324. text {
  325. margin-right: 38rpx;
  326. }
  327. }
  328. }
  329. </style>