confirmCompanyOrder.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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.productImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-box">
  11. <view>
  12. <view class="name-box ellipsis2">
  13. <view class="tag">{{utils.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. <input type="text" v-model="payAmount" placeholder="请输入货到付款金额" class="intxt pay_type" maxlength="8" />
  58. </modal>
  59. </view>
  60. </template>
  61. <script>
  62. import {getSalesOrder,addUserCart,updateSalseOrderMoney} 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. isAgreement:false,
  75. payAmount:null,
  76. CompanyUserInfo:uni.getStorageSync('CompanyUserInfo')
  77. }
  78. },
  79. onLoad(option) {
  80. this.orderKey=option.orderKey;
  81. this.getSalesOrder();
  82. },
  83. //发送给朋友
  84. onShareAppMessage(res) {
  85. return {
  86. title: "鸿森堂-您的专属健康解决方案",
  87. path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey+'&companyUserId='+this.CompanyUserInfo.userId,
  88. imageUrl: '/static/logo.jpg' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  89. }
  90. },
  91. //分享到朋友圈
  92. onShareTimeline(res) {
  93. return {
  94. title:"鸿森堂-您的专属健康解决方案",
  95. query:'orderKey='+this.orderKey,
  96. imageUrl: '/static/logo.jpg' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  97. }
  98. },
  99. methods: {
  100. handleAgreement(){
  101. this.isAgreement=!this.isAgreement
  102. },
  103. openUpdateMoney(){
  104. console.log(1)
  105. this.inputShow = true
  106. },
  107. cancelUpdateMoney(){
  108. this.inputShow = false
  109. },
  110. confirmUpdateMoney(){
  111. console.log(parseFloat(this.inputTxt) )
  112. console.log(parseFloat(this.payAmount) )
  113. if(parseFloat(this.inputTxt)>0||parseFloat(this.payAmount)>0){
  114. var that=this;
  115. if(this.inputTxt==0){
  116. this.inputTxt=this.price.totalPrice.toFixed(2)
  117. }
  118. var data={createOrderKey:this.orderKey,token:uni.getStorageSync('CompanyUserToken'),money:this.inputTxt,payAmount:this.payAmount}
  119. updateSalseOrderMoney(data).then(
  120. res => {
  121. if(res.code==200){
  122. this.inputShow = false
  123. this.getSalesOrder();
  124. }else{
  125. uni.showToast({
  126. icon:'none',
  127. title: res.msg,
  128. });
  129. }
  130. },
  131. rej => {}
  132. );
  133. }
  134. else{
  135. uni.showToast({
  136. icon:'none',
  137. title: "必须其中一个金额大于0",
  138. });
  139. }
  140. },
  141. showDetail(item) {
  142. uni.navigateTo({
  143. url: 'productDetails?productId='+item.productId
  144. })
  145. },
  146. getSalesOrder(){
  147. var that=this;
  148. that.price.payPrice=0;
  149. that.price.totalPrice=0;
  150. var data={createOrderKey:this.orderKey}
  151. getSalesOrder(data).then(
  152. res => {
  153. if(res.code==200){
  154. this.carts=res.carts;
  155. this.carts.forEach(function(element) {
  156. that.price.payPrice+=element.price*element.cartNum;
  157. });
  158. that.price.totalPrice=res.totalMoney
  159. }else{
  160. uni.showToast({
  161. icon:'none',
  162. title: res.msg,
  163. });
  164. }
  165. },
  166. rej => {}
  167. );
  168. },
  169. }
  170. }
  171. </script>
  172. <style lang="scss">
  173. .pay_type{
  174. margin-top: 20rpx;
  175. }
  176. .inner-box{
  177. padding: 20upx 20upx 140upx;
  178. .goods-list{
  179. margin-top: 20upx;
  180. padding: 0 30upx;
  181. background-color: #FFFFFF;
  182. border-radius: 16upx;
  183. .item{
  184. padding: 30upx 0;
  185. border-bottom: 1px solid #EDEEEF;
  186. display: flex;
  187. align-items: center;
  188. .img-box{
  189. width: 160upx;
  190. height: 160upx;
  191. margin-right: 30upx;
  192. image{
  193. width: 100%;
  194. height: 100%;
  195. }
  196. }
  197. .info-box{
  198. width: calc(100% - 190upx);
  199. height: 160upx;
  200. display: flex;
  201. flex-direction: column;
  202. justify-content: space-between;
  203. .name-box{
  204. font-size: 28upx;
  205. font-family: PingFang SC;
  206. font-weight: 500;
  207. color: #111111;
  208. line-height: 40upx;
  209. .tag{
  210. display: inline-block;
  211. padding: 0 6upx;
  212. height: 30upx;
  213. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  214. border-radius: 4upx;
  215. margin-right: 10upx;
  216. font-size: 22upx;
  217. font-family: PingFang SC;
  218. font-weight: bold;
  219. color: #FFFFFF;
  220. line-height: 30upx;
  221. float: left;
  222. margin-top: 7upx;
  223. }
  224. }
  225. .spec{
  226. margin-top: 10upx;
  227. font-size: 24upx;
  228. font-family: PingFang SC;
  229. font-weight: 500;
  230. color: #999999;
  231. line-height: 1;
  232. }
  233. .price-num{
  234. display: flex;
  235. align-items: center;
  236. justify-content: space-between;
  237. .price{
  238. display: flex;
  239. align-items: flex-end;
  240. .unit{
  241. font-size: 24upx;
  242. font-family: PingFang SC;
  243. font-weight: 500;
  244. color: #111111;
  245. line-height: 1.2;
  246. margin-right: 4upx;
  247. }
  248. .num{
  249. font-size: 32upx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #111111;
  253. line-height: 1;
  254. }
  255. }
  256. .num{
  257. font-size: 24upx;
  258. font-family: PingFang SC;
  259. font-weight: 500;
  260. color: #999999;
  261. line-height: 1;
  262. }
  263. }
  264. }
  265. }
  266. .sub-total{
  267. height: 88upx;
  268. display: flex;
  269. align-items: center;
  270. justify-content: flex-end;
  271. .label{
  272. font-size: 24upx;
  273. font-family: PingFang SC;
  274. font-weight: 500;
  275. color: #999999;
  276. }
  277. .price{
  278. display: flex;
  279. align-items: flex-end;
  280. .unit{
  281. font-size: 24upx;
  282. font-family: PingFang SC;
  283. font-weight: 500;
  284. color: #FF6633;
  285. line-height: 1.2;
  286. margin-right: 4upx;
  287. }
  288. .num{
  289. font-size: 32upx;
  290. font-family: PingFang SC;
  291. font-weight: bold;
  292. color: #FF6633;
  293. line-height: 1;
  294. }
  295. }
  296. }
  297. }
  298. .points{
  299. height: 88upx;
  300. padding: 0 30upx;
  301. background: #FFFFFF;
  302. border-radius: 16upx;
  303. display: flex;
  304. align-items: center;
  305. justify-content: space-between;
  306. .left{
  307. display: flex;
  308. align-items: center;
  309. image{
  310. width: 28upx;
  311. height: 28upx;
  312. margin-right: 20upx;
  313. }
  314. .text{
  315. font-size: 28upx;
  316. font-family: PingFang SC;
  317. font-weight: 500;
  318. color: #666666;
  319. }
  320. }
  321. .right{
  322. display: flex;
  323. align-items: center;
  324. .text{
  325. font-size: 28upx;
  326. font-family: PingFang SC;
  327. font-weight: 500;
  328. color: #111111;
  329. }
  330. image{
  331. margin-left: 15upx;
  332. width: 14upx;
  333. height: 24upx;
  334. }
  335. }
  336. }
  337. .remarks{
  338. height: 88upx;
  339. padding: 0 30upx;
  340. background: #FFFFFF;
  341. border-radius: 16upx;
  342. margin-top: 20upx;
  343. display: flex;
  344. align-items: center;
  345. input{
  346. width: 100%;
  347. font-size: 28upx;
  348. font-family: PingFang SC;
  349. font-weight: 500;
  350. color: #000000;
  351. }
  352. .input{
  353. font-size: 28upx;
  354. font-family: PingFang SC;
  355. font-weight: 500;
  356. color: #999999;
  357. }
  358. }
  359. }
  360. .btn-foot{
  361. box-sizing: border-box;
  362. width: 100%;
  363. height: 121upx;
  364. background: #FFFFFF;
  365. padding: 16upx 30upx;
  366. display: flex;
  367. align-items: center;
  368. justify-content: flex-end;
  369. position: fixed;
  370. left: 0;
  371. bottom: 0;
  372. z-index: 99;
  373. .right{
  374. display: flex;
  375. align-items: center;
  376. .total{
  377. display: flex;
  378. align-items: flex-end;
  379. margin-right: 15upx;
  380. .label{
  381. font-size: 26upx;
  382. font-family: PingFang SC;
  383. font-weight: 500;
  384. color: #999999;
  385. line-height: 1.5;
  386. }
  387. .price{
  388. display: flex;
  389. align-items: flex-end;
  390. .unit{
  391. font-size: 28upx;
  392. font-family: PingFang SC;
  393. font-weight: bold;
  394. color: #FF6633;
  395. line-height: 1.2;
  396. margin-right: 10upx;
  397. }
  398. .num{
  399. font-size: 32upx;
  400. font-family: PingFang SC;
  401. font-weight: bold;
  402. color: #FF6633;
  403. line-height: 1;
  404. }
  405. }
  406. }
  407. .btn{
  408. margin-left: 10rpx;
  409. width: 180upx;
  410. height: 88upx;
  411. line-height: 88upx;
  412. text-align: center;
  413. font-size: 30upx;
  414. font-family: PingFang SC;
  415. font-weight: bold;
  416. color: #FFFFFF;
  417. background: #2BC7B9;
  418. border-radius: 44upx;
  419. position: relative;
  420. .share{
  421. display: inline-block;
  422. position: absolute;
  423. top: 0;
  424. left: 0;
  425. width: 100%;
  426. height: 100%rpx;
  427. opacity: 0;
  428. }
  429. }
  430. }
  431. }
  432. </style>