commodityDetails.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view>
  3. <view style="width: 100%;height: 750rpx;">
  4. <image :src="form.filesList[0].url" mode="aspectFit" style="width: 100%;height: 750rpx;" @click='previewImage()'/>
  5. </view>
  6. <view style="background-color: #fff;padding: 43rpx 65rpx;margin-bottom: 20rpx;">
  7. <view style="display: flex;justify-content: space-between;">
  8. <view style="display: flex;color: #E75F37;font-size: 40rpx;align-items: flex-end;">
  9. <view style="font-size: 26rpx;height: 40rpx;">
  10. </view>
  11. <view style="font-size: 40rpx;">
  12. {{ checkStatus == '通过' ? form.mallPrice|| 0 :'***'}}
  13. </view>
  14. </view>
  15. <view style="display: flex;align-items: center;">
  16. <view v-if="dataForm.thisLocality" style="display: flex;margin-right: 20rpx;">
  17. <image v-if="Number(dataForm.thisLocality.inventory)" src="/static/images/tabBar/11.png"
  18. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  19. <image v-if="Number(dataForm.thisLocality.inventory)==0" src="/static/images/tabBar/14.png"
  20. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  21. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  22. 库存:{{ dataForm.thisLocality.inventory ? Number(dataForm.thisLocality.inventory) > 10 ? '充足' : dataForm.thisLocality.inventory : '' }}
  23. </view>
  24. </view>
  25. <view v-if="dataForm.offsite" style="display: flex;align-items: center;">
  26. <image v-if="Number(dataForm.offsite.inventory)" src="/static/images/tabBar/12.png"
  27. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  28. <image v-if="Number(dataForm.offsite.inventory)==0" src="/static/images/tabBar/15.png"
  29. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  30. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  31. 库存:{{ dataForm.offsite.inventory ? Number(dataForm.offsite.inventory) > 10 ? '充足' : dataForm.offsite.inventory : '' }}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view style="margin-top: 38rpx;">
  37. <u--text :text="form.cname" size="26rpx" color='#797979' lines="2"></u--text>
  38. </view>
  39. <view style="display: flex;justify-content: space-between;margin-top: 8rpx;align-items: center;">
  40. <view style="font-size: 24rpx;color: #C4C4C4;">
  41. 库存:{{ form.inventory ? Number(form.inventory) > 10 ? '充足' : form.inventory : '' }}
  42. </view>
  43. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory" buttonSize="53rpx" color="#414141"
  44. bgColor="#fff" iconStyle="color:#A4A4A4"></u-number-box>
  45. </view>
  46. <view style="display: flex;;margin-top: 8rpx;align-items:center;" v-for="(item, index) in inventoryData"
  47. :key="index">
  48. <view style="border-radius: 10rpx;border: 2rpx solid #F6744D;font-size: 26rpx;color: #E75F37;">
  49. {{item.storageName}}
  50. </view>
  51. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 35rpx;">
  52. 库存:{{Number(item.storeInventory) > 10 ? '充足' : Number(item.storeInventory)}}
  53. </view>
  54. </view>
  55. </view>
  56. <view style="background-color: #fff;padding:62rpx 62rpx 37rpx 62rpx;margin-bottom: 20rpx;">
  57. <view style="font-weight: 400;font-size: 26rpx;color: #797979;" v-show="arrow">
  58. <view style="display: flex;justify-content: space-between;">
  59. <view>
  60. 规格型号:{{ form.specificationAndModel||'-' }}
  61. </view>
  62. <view>
  63. 花纹:{{ form.brandItem || '-' }}
  64. </view>
  65. </view>
  66. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  67. <view>
  68. 产地:{{ form.placeProduction || '-' }}
  69. </view>
  70. <view>
  71. 防爆:{{ form.explosionProof == 1 ? "是" : "否" }}
  72. </view>
  73. </view>
  74. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  75. <view>
  76. 原厂:{{ form.originalFactory == 1 ? '是' : '否' }}
  77. </view>
  78. <view>
  79. 自修复:{{ form.selfRecovery == 1 ? '是' : '否' }}
  80. </view>
  81. </view>
  82. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  83. <view>
  84. 商品描述:{{ form.goodsDescription || '-' }}
  85. </view>
  86. </view>
  87. </view>
  88. <view style="display: flex;justify-content: center;margin-top: 49rpx;" @click="arrow = !arrow">
  89. <image v-if="arrow" src="/static/images/tabBar/10.png" mode="aspectFit" style="width: 33rpx;height: 26rpx;" />
  90. <image v-if="!arrow" src="/static/images/tabBar/10.png" mode="aspectFit" style="width: 33rpx;height: 26rpx;transform: rotate(180deg)" />
  91. </view>
  92. </view>
  93. <view style="background-color: #fff;padding:40rpx 62rpx;margin-bottom: 20rpx;">
  94. <view style="font-weight: 400;font-size: 30rpx;color: #F6744D;">
  95. 商品详情
  96. </view>
  97. </view>
  98. <view style="width: 100%;background-color: #fff;" >
  99. <view v-html="form.detailsText"></view>
  100. </view>
  101. <view class="text-bottom">
  102. </view>
  103. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top:2rpx #F2F2F2 solid;"
  104. class="dynamic-bottom">
  105. <view style="display: flex;justify-content: space-around;align-items: center;">
  106. <view style="width: 71rpx;display: flex;flex-direction: column;align-items: center;"
  107. @click="shoppingCart">
  108. <view class="">
  109. <image src="/static/images/tabBar/16.png" mode="aspectFit"
  110. style="width: 31rpx;height: 28rpx;" />
  111. </view>
  112. <view style="font-size: 24rpx;color: #797979;">
  113. 购物车
  114. </view>
  115. </view>
  116. <view style="width:360rpx;">
  117. <u-button v-if="form.inventory > 0" type="primary" @click="placeAnOrder" text="加入购物车"
  118. color="#E75F37" shape='circle'></u-button>
  119. <u-button v-if="form.inventory == 0" type="primary" @click="soldOut" text="已售罄" color="#c8c9cc"
  120. shape='circle'></u-button>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 提取去登录 -->
  125. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
  126. @cancel="adminShow = false"></u-modal>
  127. </view>
  128. </template>
  129. <script>
  130. import {
  131. appDetail,
  132. addToCart,
  133. appModifyPrice,
  134. stockDescList,
  135. stockDescListV1
  136. } from '@/api/tabBar/home.js'
  137. export default {
  138. data() {
  139. return {
  140. checkboxValue: [],
  141. form: {
  142. shareList: []
  143. },
  144. arrow: true,
  145. dataList: [],
  146. screen: {},
  147. columns: [],
  148. keyName: '',
  149. showWarehouse: false,
  150. dataForm: {
  151. thisLocality: {},
  152. offsite: {}
  153. },
  154. inventoryFalse: true,
  155. inventoryData: [],
  156. // 审核状态
  157. checkStatus: '',
  158. adminShow: false,
  159. }
  160. },
  161. onLoad(onLoad) {
  162. this.checkStatus = uni.getStorageSync('checkStatus');
  163. appDetail(onLoad).then(res => {
  164. this.dataForm = res.data
  165. if (res.data.type == 0) {
  166. this.form = res.data.thisLocality
  167. } else {
  168. this.form = res.data.offsite
  169. }
  170. this.form.goodsNum = Number(this.form.goodsNum)
  171. this.stockDescListfun()
  172. })
  173. },
  174. methods: {
  175. previewImage() {
  176. uni.previewImage({
  177. current: 0, // 当前显示图片的索引,默认是0
  178. urls: [this.form.filesList[0].url] // 需要预览的图片HTTP链接列表
  179. });
  180. },
  181. // admin确认
  182. adminConfirm() {
  183. uni.clearStorageSync();
  184. uni.redirectTo({
  185. url: '/pages/login/login'
  186. })
  187. },
  188. // 轮播图点击预览
  189. swiperclick(e) {
  190. let arr = this.form.filesList.map(item => {
  191. return item.url
  192. })
  193. uni.previewImage({
  194. count: arr[e],
  195. current: e,
  196. urls: arr
  197. })
  198. },
  199. inventoryFalsefun() {
  200. this.inventoryFalse = !this.inventoryFalse
  201. this.stockDescListfun()
  202. },
  203. // 库存查询
  204. stockDescListfun() {
  205. stockDescListV1({
  206. cname: this.form.cname,
  207. whether: 0
  208. }).then(res => {
  209. this.inventoryData = res.data.records
  210. })
  211. },
  212. soldOut() {
  213. uni.showToast({
  214. icon: "none",
  215. title: '商品已售罄',
  216. mask: true
  217. });
  218. },
  219. backToHome() {
  220. uni.$u.route({
  221. url: 'pages/tabBar/home',
  222. type: "switchTab"
  223. })
  224. },
  225. // 加入购物车
  226. placeAnOrder() {
  227. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  228. this.adminShow = true
  229. return
  230. }
  231. uni.showLoading({
  232. title: '加载中',
  233. mask: true
  234. });
  235. addToCart({
  236. ...this.form,
  237. whetherIntegral: '1',
  238. detailsText: ''
  239. }).then(res => {
  240. uni.hideLoading();
  241. uni.showToast({
  242. title: "加入购物车成功",
  243. icon: "none",
  244. });
  245. }).catch(err => {
  246. uni.hideLoading();
  247. })
  248. },
  249. filterAll(screen) {
  250. this.screen = screen
  251. switch (screen[1]) {
  252. case "salesCompanyId":
  253. this.columns = [this.form.shareList]
  254. this.keyName = screen[1]
  255. this.showWarehouse = true
  256. break
  257. }
  258. },
  259. confirmWarehouse(e) {
  260. appModifyPrice({
  261. id: e.value[0].id
  262. }).then(res => {
  263. this.form.salesCompanyName = e.value[0].salesCompanyName
  264. this.form.salesCompanyId = e.value[0].salesCompanyId
  265. this.form.mallPrice = res.data.mallPrice
  266. this.form.inventory = res.data.inventory
  267. this.showWarehouse = false
  268. })
  269. },
  270. groupChange(val) {
  271. console.log(val)
  272. if (val == 0) {
  273. this.form = this.dataForm.thisLocality
  274. } else {
  275. this.form = this.dataForm.offsite
  276. }
  277. },
  278. shoppingCart() {
  279. uni.setStorageSync('tabKey', 2)
  280. uni.$u.route({
  281. url: 'pages/integralMall/index'
  282. })
  283. }
  284. }
  285. }
  286. </script>
  287. <style lang="scss" scoped>
  288. ::v-deep .u-number-box {
  289. border: 2rpx #E1E1E1 solid;
  290. border-radius: 8rpx;
  291. }
  292. ::v-deep .u-number-box__minus {
  293. border-right: 2rpx #E1E1E1 solid;
  294. }
  295. ::v-deep .u-number-box__plus {
  296. border-left: 2rpx #E1E1E1 solid;
  297. }
  298. ::v-deep .u-button {
  299. height: 60rpx;
  300. }
  301. .dynamic-bottom {
  302. padding: 20rpx 20rpx 0 20rpx;
  303. padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
  304. }
  305. .text-bottom {
  306. height: calc(env(safe-area-inset-bottom) + 126rpx);
  307. }
  308. </style>