confirmCompanyOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 药品列表 -->
  5. <view class="goods-list">
  6. <view v-for="(item,index) in carts" :key="index" class="item" @click="showDetail(item)">
  7. <view class="img-box">
  8. <image :src="source=='audit'?item.image : item.productAttrImage||item.productImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-box">
  11. <view>
  12. <view class="name-box ellipsis2">
  13. <view class="myotctxt" style="margin-right: 10rpx;" v-show="item.productType" :style="{background:_background(item.productType)}">{{$getDictLabelName("storeProductType",item.productType)}}</view>
  14. {{ item.commonName&&item.commonName!=='-'?item.commonName:item.productName }}
  15. </view>
  16. <view class="spec ellipsis2">{{item.productAttrName}}</view>
  17. </view>
  18. <view class="price-num">
  19. <view class="price">
  20. <text class="unit">¥</text>
  21. <text class="num">{{item.price?item.price.toFixed(2):'0.00'}}</text>
  22. </view>
  23. <view class="num">x{{item.cartNum}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 小计 -->
  28. <view class="sub-total">
  29. <text class="label">合计金额:</text>
  30. <view class="price">
  31. <text class="unit">¥</text>
  32. <text class="num">{{price.payPrice?price.payPrice.toFixed(2):'0.00'}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 底部按钮 -->
  38. <view class="btn-foot">
  39. <view class="right">
  40. <view class="total" >
  41. <text class="label">总金额:</text>
  42. <view class="price">
  43. <text class="unit">¥</text>
  44. <text class="num">{{price.totalPrice?price.totalPrice.toFixed(2):'0.00'}}</text>
  45. </view>
  46. </view>
  47. <view class="btn" @click="openUpdateMoney()" v-if="source!='audit'">
  48. 实收金额
  49. </view>
  50. <view class="btn" v-show="!disabled">
  51. 分享
  52. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  53. </view>
  54. </view>
  55. </view>
  56. <modal v-if="inputShow" title="实收金额" confirm-text="保存" cancel-text="取消" @cancel="cancelUpdateMoney" @confirm="confirmUpdateMoney">
  57. <input type="text" v-model="inputTxt" placeholder="请输入实收金额" class="intxt" maxlength="8" />
  58. </modal>
  59. </view>
  60. </template>
  61. <script>
  62. import {getSalesOrder,getSalesOrders,updateSalseOrderMoney,sharePrepare,changeListDetail} from '../api/companyOrder.js'
  63. export default {
  64. data() {
  65. return {
  66. inputShow:false,
  67. inputTxt:null,
  68. orderKey:null,
  69. price:{
  70. payPrice:0.00,
  71. totalPrice:0.00,
  72. },
  73. carts:[],
  74. disabled: false,
  75. source:'', // audit审核页过来的
  76. auditId:''
  77. }
  78. },
  79. computed: {
  80. _background() {
  81. //productType: 1:OTC,2:Rx,3:非药品,4:器械
  82. return (productType)=> {
  83. switch (productType) {
  84. case 1: return '#37E2EA' // OTC
  85. case 2: return 'red' // Rx
  86. case 3: return '#2583EB' // 非药品
  87. case 4: return '#999' // 器械
  88. default: return '#ccc'
  89. }
  90. }
  91. }
  92. },
  93. onLoad(option) {
  94. this.source = option.source || ''
  95. if(this.source == 'audit') {
  96. uni.hideShareMenu()
  97. this.disabled = true
  98. this.auditId = option.auditId || ''
  99. this.sharePrepare()
  100. this.getDetail()
  101. } else {
  102. this.orderKey=option.orderKey;
  103. uni.showShareMenu()
  104. this.getSalesOrder();
  105. }
  106. },
  107. //发送给朋友
  108. onShareAppMessage(res) {
  109. return {
  110. title: "医健宝医药",
  111. path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey,
  112. imageUrl: 'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/sharelogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  113. }
  114. },
  115. methods: {
  116. openUpdateMoney(){
  117. if(this.disabled) {
  118. uni.showModal({
  119. title: '提示',
  120. content: '✅ 实收金额改价申请审核中!',
  121. showCancel: false,
  122. success: function (res) {
  123. if (res.confirm) {
  124. console.log('用户点击确认');
  125. } else if (res.cancel) {
  126. console.log('用户点击取消');
  127. }
  128. }
  129. });
  130. return
  131. }
  132. this.inputShow = true
  133. },
  134. cancelUpdateMoney(){
  135. this.inputShow = false
  136. },
  137. confirmUpdateMoney(){
  138. if(parseFloat(this.inputTxt)>0){
  139. var that=this;
  140. var data={totalAmount: this.price.totalPrice,createOrderKey:this.orderKey,token:uni.getStorageSync('CompanyUserToken'),money:this.inputTxt}
  141. updateSalseOrderMoney(data).then(
  142. res => {
  143. if(res.code==200){
  144. this.disabled = res.disabled
  145. if(this.disabled) {
  146. uni.hideShareMenu()
  147. } else {
  148. uni.showShareMenu()
  149. }
  150. this.inputShow = false
  151. this.getSalesOrder();
  152. uni.showModal({
  153. title: '提示',
  154. content: '✅ 实收金额改价申请已提交!',
  155. showCancel: false,
  156. success: function (res) {
  157. if (res.confirm) {
  158. uni.navigateBack()
  159. } else if (res.cancel) {
  160. console.log('用户点击取消');
  161. }
  162. }
  163. });
  164. }else{
  165. uni.showToast({
  166. icon:'none',
  167. title: res.msg,
  168. });
  169. }
  170. },
  171. rej => {}
  172. );
  173. }
  174. else{
  175. uni.showToast({
  176. icon:'none',
  177. title: "价格应大于0",
  178. });
  179. }
  180. },
  181. showDetail(item) {
  182. uni.navigateTo({
  183. url: 'productDetails?productId='+item.productId
  184. })
  185. },
  186. getSalesOrder(){
  187. var that=this;
  188. that.price.payPrice=0;
  189. that.price.totalPrice=0;
  190. var data={createOrderKey:this.orderKey}
  191. getSalesOrder(data).then(
  192. res => {
  193. if(res.code==200){
  194. this.carts=res.carts;
  195. this.carts.forEach(function(element) {
  196. that.price.payPrice+=element.price*element.cartNum;
  197. });
  198. that.price.totalPrice=res.totalMoney
  199. }else{
  200. uni.showToast({
  201. icon:'none',
  202. title: res.msg,
  203. });
  204. }
  205. },
  206. rej => {}
  207. );
  208. },
  209. sharePrepare() {
  210. const param = {
  211. token:uni.getStorageSync('CompanyUserToken'),
  212. id:this.auditId,
  213. }
  214. sharePrepare(param).then(res=>{
  215. if(res.code==200) {
  216. uni.showShareMenu()
  217. this.disabled = false
  218. } else {
  219. uni.showToast({
  220. icon:'none',
  221. title: res.msg,
  222. });
  223. }
  224. })
  225. },
  226. getDetail() {
  227. let that = this
  228. changeListDetail(this.auditId).then(res=>{
  229. if(res.code==200){
  230. that.carts=res.data.preparedProductInfoVoList;
  231. that.price.payPrice = res.data.totalAmount
  232. that.price.totalPrice=res.data.money
  233. that.orderKey = res.data.createOrderKey
  234. }else{
  235. uni.showToast({
  236. icon:'none',
  237. title: res.msg,
  238. });
  239. }
  240. })
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss">
  246. .inner-box{
  247. padding: 20upx 20upx 140upx;
  248. .goods-list{
  249. margin-top: 20upx;
  250. padding: 0 30upx;
  251. background-color: #FFFFFF;
  252. border-radius: 16upx;
  253. .item{
  254. padding: 30upx 0;
  255. border-bottom: 1px solid #EDEEEF;
  256. display: flex;
  257. align-items: center;
  258. .img-box{
  259. width: 160upx;
  260. height: 160upx;
  261. margin-right: 30upx;
  262. image{
  263. width: 100%;
  264. height: 100%;
  265. }
  266. }
  267. .info-box{
  268. width: calc(100% - 190upx);
  269. height: 160upx;
  270. display: flex;
  271. flex-direction: column;
  272. justify-content: space-between;
  273. .name-box{
  274. font-size: 28upx;
  275. font-family: PingFang SC;
  276. font-weight: 500;
  277. color: #111111;
  278. line-height: 40upx;
  279. }
  280. .spec{
  281. margin-top: 10upx;
  282. font-size: 24upx;
  283. font-family: PingFang SC;
  284. font-weight: 500;
  285. color: #999999;
  286. line-height: 1;
  287. }
  288. .price-num{
  289. display: flex;
  290. align-items: center;
  291. justify-content: space-between;
  292. .price{
  293. display: flex;
  294. align-items: flex-end;
  295. .unit{
  296. font-size: 24upx;
  297. font-family: PingFang SC;
  298. font-weight: 500;
  299. color: #111111;
  300. line-height: 1.2;
  301. margin-right: 4upx;
  302. }
  303. .num{
  304. font-size: 32upx;
  305. font-family: PingFang SC;
  306. font-weight: 500;
  307. color: #111111;
  308. line-height: 1;
  309. }
  310. }
  311. .num{
  312. font-size: 24upx;
  313. font-family: PingFang SC;
  314. font-weight: 500;
  315. color: #999999;
  316. line-height: 1;
  317. }
  318. }
  319. }
  320. }
  321. .sub-total{
  322. height: 88upx;
  323. display: flex;
  324. align-items: center;
  325. justify-content: flex-end;
  326. .label{
  327. font-size: 24upx;
  328. font-family: PingFang SC;
  329. font-weight: 500;
  330. color: #999999;
  331. }
  332. .price{
  333. display: flex;
  334. align-items: flex-end;
  335. .unit{
  336. font-size: 24upx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #FF6633;
  340. line-height: 1.2;
  341. margin-right: 4upx;
  342. }
  343. .num{
  344. font-size: 32upx;
  345. font-family: PingFang SC;
  346. font-weight: bold;
  347. color: #FF6633;
  348. line-height: 1;
  349. }
  350. }
  351. }
  352. }
  353. .points{
  354. height: 88upx;
  355. padding: 0 30upx;
  356. background: #FFFFFF;
  357. border-radius: 16upx;
  358. display: flex;
  359. align-items: center;
  360. justify-content: space-between;
  361. .left{
  362. display: flex;
  363. align-items: center;
  364. image{
  365. width: 28upx;
  366. height: 28upx;
  367. margin-right: 20upx;
  368. }
  369. .text{
  370. font-size: 28upx;
  371. font-family: PingFang SC;
  372. font-weight: 500;
  373. color: #666666;
  374. }
  375. }
  376. .right{
  377. display: flex;
  378. align-items: center;
  379. .text{
  380. font-size: 28upx;
  381. font-family: PingFang SC;
  382. font-weight: 500;
  383. color: #111111;
  384. }
  385. image{
  386. margin-left: 15upx;
  387. width: 14upx;
  388. height: 24upx;
  389. }
  390. }
  391. }
  392. .remarks{
  393. height: 88upx;
  394. padding: 0 30upx;
  395. background: #FFFFFF;
  396. border-radius: 16upx;
  397. margin-top: 20upx;
  398. display: flex;
  399. align-items: center;
  400. input{
  401. width: 100%;
  402. font-size: 28upx;
  403. font-family: PingFang SC;
  404. font-weight: 500;
  405. color: #000000;
  406. }
  407. .input{
  408. font-size: 28upx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #999999;
  412. }
  413. }
  414. }
  415. .btn-foot{
  416. box-sizing: border-box;
  417. width: 100%;
  418. height: 121upx;
  419. background: #FFFFFF;
  420. padding: 16upx 30upx;
  421. display: flex;
  422. align-items: center;
  423. justify-content: flex-end;
  424. position: fixed;
  425. left: 0;
  426. bottom: 0;
  427. z-index: 99;
  428. .right{
  429. display: flex;
  430. align-items: center;
  431. .total{
  432. display: flex;
  433. align-items: flex-end;
  434. margin-right: 15upx;
  435. .label{
  436. font-size: 26upx;
  437. font-family: PingFang SC;
  438. font-weight: 500;
  439. color: #999999;
  440. line-height: 1.5;
  441. }
  442. .price{
  443. display: flex;
  444. align-items: flex-end;
  445. .unit{
  446. font-size: 28upx;
  447. font-family: PingFang SC;
  448. font-weight: bold;
  449. color: #FF6633;
  450. line-height: 1.2;
  451. margin-right: 10upx;
  452. }
  453. .num{
  454. font-size: 32upx;
  455. font-family: PingFang SC;
  456. font-weight: bold;
  457. color: #FF6633;
  458. line-height: 1;
  459. }
  460. }
  461. }
  462. .btn{
  463. margin-left: 10rpx;
  464. width: 180upx;
  465. height: 88upx;
  466. line-height: 88upx;
  467. text-align: center;
  468. font-size: 30upx;
  469. font-family: PingFang SC;
  470. font-weight: bold;
  471. color: #FFFFFF;
  472. background: #2583EB;
  473. border-radius: 44upx;
  474. position: relative;
  475. .share{
  476. display: inline-block;
  477. position: absolute;
  478. top: 0;
  479. left: 0;
  480. width: 100%;
  481. height: 100%rpx;
  482. opacity: 0;
  483. }
  484. }
  485. }
  486. }
  487. </style>