confirmCompanyOrder.vue 9.9 KB

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