confirmCompanyOrder.vue 9.3 KB

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